line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Webservice::OVH::Email::Domain::Domain::MailingList; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Webservice::OVH::Email::Domain::Domain::MailingList |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Webservice::OVH; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $ovh = Webservice::OVH->new_from_json("credentials.json"); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $email_domain = $ovh->email->domain->domain('testdomain.de'); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $mailing_list = $email_domain->new_redirection(language 'de', name => 'infos', options => {moderatorMessage => 'true', subscribeByModerator => 'true', usersPostOnly => 'false'}, owner_email => 'owner@test.de' ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Provides ability to create, delete, change and manage mailinglists. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 METHODS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
36
|
|
|
36
|
|
270
|
use strict; |
|
36
|
|
|
|
|
87
|
|
|
36
|
|
|
|
|
1207
|
|
28
|
36
|
|
|
36
|
|
211
|
use warnings; |
|
36
|
|
|
|
|
1170
|
|
|
36
|
|
|
|
|
1347
|
|
29
|
36
|
|
|
36
|
|
233
|
use Carp qw{ carp croak }; |
|
36
|
|
|
|
|
76
|
|
|
36
|
|
|
|
|
2155
|
|
30
|
36
|
|
|
36
|
|
251
|
use JSON; |
|
36
|
|
|
|
|
94
|
|
|
36
|
|
|
|
|
324
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our $VERSION = 0.46; |
33
|
|
|
|
|
|
|
|
34
|
36
|
|
|
36
|
|
5821
|
use Webservice::OVH::Helper; |
|
36
|
|
|
|
|
90
|
|
|
36
|
|
|
|
|
1000
|
|
35
|
36
|
|
|
36
|
|
18719
|
use Webservice::OVH::Email::Domain::Domain::Task; |
|
36
|
|
|
|
|
122
|
|
|
36
|
|
|
|
|
124157
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 _new_existing |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Internal Method to create a MailingList object. |
40
|
|
|
|
|
|
|
This method should never be called directly. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object, $domain - parent domain Objekt, $mailing_list_name => unique name |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Email::Domain::Domain::MailingList> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Email::Domain::Domain::MailingList->_new_existing($ovh_api_wrapper, $domain, $mailing_list_name, $module); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=back |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _new_existing { |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
0
|
|
|
my ( $class, %params ) = @_; |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
die "Missing module" unless $params{module}; |
59
|
0
|
0
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
60
|
0
|
0
|
|
|
|
|
die "Missing id" unless $params{id}; |
61
|
0
|
0
|
|
|
|
|
die "Missing domain" unless $params{domain}; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my $module = $params{module}; |
64
|
0
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
65
|
0
|
|
|
|
|
|
my $mailing_list_name = $params{id}; |
66
|
0
|
|
|
|
|
|
my $domain = $params{domain}; |
67
|
|
|
|
|
|
|
|
68
|
0
|
0
|
|
|
|
|
die "Missing mailing_list_name" unless $mailing_list_name; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $self = bless { _valid => 1, _api_wrapper => $api_wrapper, _name => $mailing_list_name, _properties => undef, _domain => $domain, _module => $module }, $class; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return $self; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 _new |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Internal Method to create the MailingList object. |
78
|
|
|
|
|
|
|
This method should never be called directly. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=over |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object, $domain - parent domain, %params - key => value |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Email::Domain::Domain::MailingList> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Email::Domain::Domain::MailingList->_new($ovh_api_wrapper, $domain, $module, language 'DE', name => 'infos', options => {}, owner_email => 'owner@test.de', reply_to => 'test@test.de' ); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=back |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _new { |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
0
|
|
|
my ( $class, %params ) = @_; |
95
|
|
|
|
|
|
|
|
96
|
0
|
0
|
|
|
|
|
die "Missing module" unless $params{module}; |
97
|
0
|
0
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
98
|
0
|
0
|
|
|
|
|
die "Missing domain" unless $params{domain}; |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
my $module = $params{module}; |
101
|
0
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
102
|
0
|
|
|
|
|
|
my $domain = $params{domain}; |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
my @keys_needed = qw{ language name options owner_email }; |
105
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
die "Missing domain" unless $domain; |
107
|
|
|
|
|
|
|
|
108
|
0
|
0
|
|
|
|
|
if ( my @missing_parameters = grep { not exists $params{$_} } @keys_needed ) { |
|
0
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
croak "Missing parameter: @missing_parameters"; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
0
|
|
|
|
my $moderator_message = $params{options}{moderator_message} || $params{options}{moderatorMessage}; |
114
|
0
|
|
0
|
|
|
|
my $subscribe_by_moderator = $params{options}{subscribe_by_moderator} || $params{options}{subscribeByModerator}; |
115
|
0
|
|
0
|
|
|
|
my $users_post_only = $params{options}{users_post_only} || $params{options}{usersPostOnly}; |
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
my $options = {}; |
118
|
0
|
0
|
0
|
|
|
|
$options->{moderatorMessage} = $moderator_message eq 'true' || $moderator_message eq 'yes' || $moderator_message eq '1' ? JSON::true : JSON::false; |
119
|
0
|
0
|
0
|
|
|
|
$options->{subscribeByModerator} = $subscribe_by_moderator eq 'true' || $subscribe_by_moderator eq 'yes' || $subscribe_by_moderator eq '1' ? JSON::true : JSON::false; |
120
|
0
|
0
|
0
|
|
|
|
$options->{usersPostOnly} = $users_post_only eq 'true' || $users_post_only eq 'yes' || $users_post_only eq '1' ? JSON::true : JSON::false; |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
my $domain_name = $domain->name; |
123
|
0
|
|
|
|
|
|
my $body = {}; |
124
|
0
|
|
|
|
|
|
$body->{language} = $params{language}; |
125
|
0
|
|
|
|
|
|
$body->{name} = Webservice::OVH::Helper->trim($params{name}); |
126
|
0
|
|
|
|
|
|
$body->{options} = $options; |
127
|
0
|
|
|
|
|
|
$body->{ownerEmail} = Webservice::OVH::Helper->trim($params{owner_email}); |
128
|
0
|
0
|
|
|
|
|
$body->{replyTo} = Webservice::OVH::Helper->trim($params{reply_to}) if exists $params{reply_to}; |
129
|
0
|
|
|
|
|
|
my $response = $api_wrapper->rawCall( method => 'post', path => "/email/domain/$domain_name/mailingList", body => $body, noSignature => 0 ); |
130
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
131
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
my $task_id = $response->content->{id}; |
133
|
0
|
|
|
|
|
|
my $task = Webservice::OVH::Email::Domain::Domain::Task::Mailinglist->_new_existing( wrapper => $api_wrapper, domain => $domain, id => $task_id, module => $module ); |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
my $self = bless { _valid => 1, _api_wrapper => $api_wrapper, _properties => undef, _name => $params{name}, _domain => $domain, _module => $module }, $class; |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
return ( $self, $task ); |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 is_valid |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
When this mailinglist is deleted on the api side, this method returns 0. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=over |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item * Return: VALUE |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * Synopsis: print "Valid" if $mailing_list->is_valid; |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=back |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub is_valid { |
155
|
|
|
|
|
|
|
|
156
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
157
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
$self->properties; |
159
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
return $self->{_valid}; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 name |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Unique identifier. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=over |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * Return: VALUE |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * Synopsis: my $name = $redirection->name; |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=back |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=cut |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub name { |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
180
|
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
|
return $self->{_name}; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 id |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Secondary unique identifier. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=over |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item * Return: VALUE |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * Synopsis: my $id = $mailing_list->id; |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=back |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=cut |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub id { |
199
|
|
|
|
|
|
|
|
200
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
201
|
|
|
|
|
|
|
|
202
|
0
|
0
|
|
|
|
|
$self->properties unless $self->{_properties}; |
203
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
204
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
|
return $self->{properties}{id}; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 domain |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Returns the email-domain this redirection is attached to. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=over |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=item * Return: L<Webservice::Email::Domain::Domain> |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item * Synopsis: my $email_domain = $mailing_list->domain; |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=back |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=cut |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
sub domain { |
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
225
|
|
|
|
|
|
|
|
226
|
0
|
|
|
|
|
|
return $self->{_domain}; |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head2 properties |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Returns the raw properties as a hash. |
232
|
|
|
|
|
|
|
This is the original return value of the web-api. |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=over |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item * Return: HASH |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=item * Synopsis: my $properties = $mailing_list->properties; |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=back |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=cut |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub properties { |
245
|
|
|
|
|
|
|
|
246
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
247
|
|
|
|
|
|
|
|
248
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
249
|
|
|
|
|
|
|
|
250
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
251
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
252
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
253
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/mailingList/$mailing_list_name", noSignature => 0 ); |
254
|
0
|
0
|
|
|
|
|
carp $response->error if $response->error; |
255
|
|
|
|
|
|
|
|
256
|
0
|
0
|
|
|
|
|
if ( $response->error ) { |
257
|
|
|
|
|
|
|
|
258
|
0
|
|
|
|
|
|
$self->{_valid} = 0; |
259
|
0
|
|
|
|
|
|
$self->{_properties} = undef; |
260
|
0
|
|
|
|
|
|
return undef; |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
} else { |
263
|
|
|
|
|
|
|
|
264
|
0
|
|
|
|
|
|
$self->{_properties} = $response->content; |
265
|
0
|
|
|
|
|
|
return $self->{_properties}; |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=head2 language |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
Exposed property value. |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=over |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=item * Return: VALUE |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=item * Synopsis: my $language = $mailing_list->language; |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=back |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=cut |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
sub language { |
284
|
|
|
|
|
|
|
|
285
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
286
|
|
|
|
|
|
|
|
287
|
0
|
0
|
|
|
|
|
$self->properties unless $self->{_properties}; |
288
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
289
|
|
|
|
|
|
|
|
290
|
0
|
|
|
|
|
|
return $self->{_properties}->{language}; |
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head2 options |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
Exposed property value. |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=over |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=item * Return: HASH |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=item * Synopsis: my $options = $mailing_list->options; |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=back |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=cut |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
sub options { |
308
|
|
|
|
|
|
|
|
309
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
310
|
|
|
|
|
|
|
|
311
|
0
|
0
|
|
|
|
|
$self->properties unless $self->{_properties}; |
312
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
313
|
|
|
|
|
|
|
|
314
|
0
|
|
|
|
|
|
return $self->{_properties}->{options}; |
315
|
|
|
|
|
|
|
} |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=head2 owner_email |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
Exposed property value. |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=over |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=item * Return: VALUE |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
=item * Synopsis: my $owner_email = $mailing_list->owner_email; |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=back |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
=cut |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
sub owner_email { |
332
|
|
|
|
|
|
|
|
333
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
334
|
|
|
|
|
|
|
|
335
|
0
|
0
|
|
|
|
|
$self->properties unless $self->{_properties}; |
336
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
337
|
|
|
|
|
|
|
|
338
|
0
|
|
|
|
|
|
return $self->{_properties}->{ownerEmail}; |
339
|
|
|
|
|
|
|
} |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=head2 reply_to |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
Exposed property value. |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=over |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=item * Return: VALUE |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=item * Synopsis: my $reply_to = $mailing_list->reply_to; |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=back |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=cut |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
sub reply_to { |
356
|
|
|
|
|
|
|
|
357
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
358
|
|
|
|
|
|
|
|
359
|
0
|
0
|
|
|
|
|
$self->properties unless $self->{_properties}; |
360
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
361
|
|
|
|
|
|
|
|
362
|
0
|
|
|
|
|
|
return $self->{_properties}->{replyTo}; |
363
|
|
|
|
|
|
|
} |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=head2 nb_subscribers_update_date |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
Exposed property value. |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=over |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=item * Return: VALUE |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=item * Synopsis: my $nb_subscribers_update_date = $mailing_list->nb_subscribers_update_date; |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
=back |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=cut |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
sub nb_subscribers_update_date { |
380
|
|
|
|
|
|
|
|
381
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
382
|
|
|
|
|
|
|
|
383
|
0
|
0
|
|
|
|
|
$self->properties unless $self->{_properties}; |
384
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
385
|
|
|
|
|
|
|
|
386
|
0
|
|
|
|
|
|
my $str_datetime = $self->{_properties}->{nbSubscribersUpdateDate}; |
387
|
0
|
|
|
|
|
|
my $datetime = Webservice::OVH::Helper->parse_datetime($str_datetime); |
388
|
|
|
|
|
|
|
|
389
|
0
|
|
|
|
|
|
return $datetime; |
390
|
|
|
|
|
|
|
} |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
=head2 nb_subscribers |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
Exposed property value. |
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
=over |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
=item * Return: VALUE |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
=item * Synopsis: my $nb_subscribers = $mailing_list->nb_subscribers; |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
=back |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
=cut |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
sub nb_subscribers { |
407
|
|
|
|
|
|
|
|
408
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
409
|
|
|
|
|
|
|
|
410
|
0
|
0
|
|
|
|
|
$self->properties unless $self->{_properties}; |
411
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
412
|
|
|
|
|
|
|
|
413
|
0
|
|
|
|
|
|
return $self->{_properties}->{nbSubscribers}; |
414
|
|
|
|
|
|
|
} |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=head2 change |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
Changes the objcet. |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
=over |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
=item * Parameter: %params - key => value language owner_email reply_to |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
=item * Synopsis: $mailing_list->change( language => 'en', owner_email => 'other@test.de', reply_to => 'reply@test.de'); |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
=back |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
=cut |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
sub change { |
431
|
|
|
|
|
|
|
|
432
|
0
|
|
|
0
|
1
|
|
my ( $self, %params ) = @_; |
433
|
|
|
|
|
|
|
|
434
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
435
|
|
|
|
|
|
|
|
436
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
437
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
438
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
439
|
0
|
|
|
|
|
|
my $body = {}; |
440
|
0
|
0
|
|
|
|
|
$body->{language} = $params{language} if exists $params{language}; |
441
|
0
|
0
|
|
|
|
|
$body->{ownerEmail} = Webservice::OVH::Helper->trim($params{owner_email}) if exists $params{owner_email}; |
442
|
0
|
0
|
|
|
|
|
$body->{replyTo} = Webservice::OVH::Helper->trim($params{reply_to}) if exists $params{reply_to}; |
443
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'put', path => "/email/domain/$domain_name/mailingList/$mailing_list_name", body => $body, noSignature => 0 ); |
444
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
445
|
|
|
|
|
|
|
|
446
|
0
|
|
|
|
|
|
$self->properties; |
447
|
|
|
|
|
|
|
} |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=head2 delete |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
Deletes the mailinglist api sided and sets this object invalid. |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
=over |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
=item * Synopsis: $mailing_list->delete; |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
=back |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
=cut |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
sub delete { |
462
|
|
|
|
|
|
|
|
463
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
464
|
|
|
|
|
|
|
|
465
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
466
|
|
|
|
|
|
|
|
467
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
468
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
469
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
470
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'delete', path => "/email/domain/$domain_name/mailingList/$mailing_list_name", noSignature => 0 ); |
471
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
472
|
|
|
|
|
|
|
|
473
|
0
|
|
|
|
|
|
my $task_id = $response->content->{id}; |
474
|
0
|
|
|
|
|
|
my $task = Webservice::OVH::Email::Domain::Domain::Task::Mailinglist->_new_existing( wrapper => $api, domain => $self->domain, id => $task_id, module => $self->{_module} ); |
475
|
|
|
|
|
|
|
|
476
|
0
|
|
|
|
|
|
$self->{_valid} = 0; |
477
|
|
|
|
|
|
|
|
478
|
0
|
|
|
|
|
|
return $task; |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
=head2 change_options |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
Changes additional options. |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
=over |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
=item * Parameter: %params - key => value moderator_message subscribe_by_moderator users_post_only |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
=item * Synopsis: $mailing_list->change_options( moderator_message => 'false', subscribe_by_moderator => 'false', users_post_only => 'true' ); |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
=back |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
=cut |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
sub change_options { |
496
|
|
|
|
|
|
|
|
497
|
0
|
|
|
0
|
1
|
|
my ( $self, %params ) = @_; |
498
|
|
|
|
|
|
|
|
499
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
500
|
|
|
|
|
|
|
|
501
|
0
|
|
|
|
|
|
my @keys_needed = qw{ moderator_message subscribe_by_moderator users_post_only }; |
502
|
|
|
|
|
|
|
|
503
|
0
|
0
|
|
|
|
|
if ( my @missing_parameters = grep { not exists $params{$_} } @keys_needed ) { |
|
0
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
|
505
|
0
|
|
|
|
|
|
croak "Missing parameter: @missing_parameters"; |
506
|
|
|
|
|
|
|
} |
507
|
|
|
|
|
|
|
|
508
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
509
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
510
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
511
|
0
|
|
|
|
|
|
my $body = { options => {} }; |
512
|
0
|
0
|
|
|
|
|
$body->{options}->{moderatorMessage} = $params{moderator_message} if exists $params{moderator_message}; |
513
|
0
|
0
|
|
|
|
|
$body->{options}->{subscribeByModerator} = $params{subscribe_by_moderator} if exists $params{subscribe_by_moderator}; |
514
|
0
|
0
|
|
|
|
|
$body->{options}->{usersPostOnly} = $params{users_post_only} if exists $params{users_post_only}; |
515
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'post', path => "/email/domain/$domain_name/mailingList/$mailing_list_name/changeOptions", body => $body, noSignature => 0 ); |
516
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
517
|
|
|
|
|
|
|
|
518
|
0
|
|
|
|
|
|
my $task_id = $response->content->{id}; |
519
|
0
|
|
|
|
|
|
my $task = Webservice::OVH::Email::Domain::Domain::Task::Mailinglist->_new_existing( wrapper => $api, domain => $self->domain, id => $task_id, module => $self->{_module} ); |
520
|
|
|
|
|
|
|
|
521
|
0
|
|
|
|
|
|
$self->properties; |
522
|
|
|
|
|
|
|
|
523
|
0
|
|
|
|
|
|
return $task; |
524
|
|
|
|
|
|
|
} |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
=head2 moderators |
527
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
Returns an array of all moderators of this mailinglist. |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
=over |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
=item * Synopsis: my $moderators = $mailing_list->moderators(); |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
=back |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
=cut |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
sub moderators { |
541
|
|
|
|
|
|
|
|
542
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
543
|
|
|
|
|
|
|
|
544
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
545
|
|
|
|
|
|
|
|
546
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
547
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
548
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
549
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/mailingList/$mailing_list_name/moderator", noSignature => 0 ); |
550
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
551
|
|
|
|
|
|
|
|
552
|
0
|
|
|
|
|
|
return $response->content; |
553
|
|
|
|
|
|
|
} |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
=head2 moderators |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
Returns properties for a specified moderator E-Mail |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
=over |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
=item * Parameter: $email - email address |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=item * Return: HASH |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
=item * Synopsis: my $properties = $mailing_list->moderator('moderator@test.de'); |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=back |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
=cut |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
sub moderator { |
572
|
|
|
|
|
|
|
|
573
|
0
|
|
|
0
|
1
|
|
my ( $self, $email ) = @_; |
574
|
|
|
|
|
|
|
|
575
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
576
|
|
|
|
|
|
|
|
577
|
0
|
0
|
|
|
|
|
croak "Missing email" unless $email; |
578
|
|
|
|
|
|
|
|
579
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
580
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
581
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
582
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/mailingList/$mailing_list_name/moderator/$email", noSignature => 0 ); |
583
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
584
|
|
|
|
|
|
|
|
585
|
0
|
|
|
|
|
|
return $response->content; |
586
|
|
|
|
|
|
|
} |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
=head2 add_moderator |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
Adds a moderator via E-Mail address. |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
=over |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
=item * Parameter: $email - email address |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
=item * Synopsis: my $properties = $mailing_list->add_moderator('moderator@test.de'); |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
=back |
599
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
=cut |
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
sub add_moderator { |
603
|
|
|
|
|
|
|
|
604
|
0
|
|
|
0
|
1
|
|
my ( $self, $email ) = @_; |
605
|
|
|
|
|
|
|
|
606
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
607
|
|
|
|
|
|
|
|
608
|
0
|
0
|
|
|
|
|
croak "Missing email" unless $email; |
609
|
|
|
|
|
|
|
|
610
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
611
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
612
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
613
|
0
|
|
|
|
|
|
my $body = { email => Webservice::OVH::Helper->trim($email) }; |
614
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'post', path => "/email/domain/$domain_name/mailingList/$mailing_list_name/moderator", body => $body, noSignature => 0 ); |
615
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
616
|
|
|
|
|
|
|
|
617
|
0
|
|
|
|
|
|
my $task_id = $response->content->{id}; |
618
|
0
|
|
|
|
|
|
my $task = Webservice::OVH::Email::Domain::Domain::Task::Mailinglist->_new_existing( wrapper => $api, domain => $self->domain, id => $task_id, module => $self->{_module} ); |
619
|
|
|
|
|
|
|
|
620
|
0
|
|
|
|
|
|
return $task; |
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
} |
623
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
=head2 delete_moderator |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
Deletes a moderator via E-Mail address. |
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
=over |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
=item * Parameter: $email - email address |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
=item * Synopsis: my $properties = $mailing_list->delete_moderator('moderator@test.de'); |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
=back |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
=cut |
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
sub delete_moderator { |
639
|
|
|
|
|
|
|
|
640
|
0
|
|
|
0
|
1
|
|
my ( $self, $email ) = @_; |
641
|
|
|
|
|
|
|
|
642
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
643
|
|
|
|
|
|
|
|
644
|
0
|
0
|
|
|
|
|
croak "Missing email" unless $email; |
645
|
|
|
|
|
|
|
|
646
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
647
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
648
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
649
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'delete', path => "/email/domain/$domain_name/mailingList/$mailing_list_name/moderator/$email", noSignature => 0 ); |
650
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
651
|
|
|
|
|
|
|
|
652
|
0
|
|
|
|
|
|
my $task_id = $response->content->{id}; |
653
|
0
|
|
|
|
|
|
my $task = Webservice::OVH::Email::Domain::Domain::Task::Mailinglist->_new_existing( wrapper => $api, domain => $self->domain, id => $task_id, module => $self->{_module} ); |
654
|
|
|
|
|
|
|
|
655
|
0
|
|
|
|
|
|
return $task; |
656
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
} |
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
=head2 delete_moderator |
660
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
Sends the subscriber and moderator list to a specified E-Mail address. |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
=over |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
=item * Parameter: $email - email address |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
=item * Synopsis: my $properties = $mailing_list->send_list_by_email('moderator@test.de'); |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
=back |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
=cut |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
sub send_list_by_email { |
674
|
|
|
|
|
|
|
|
675
|
0
|
|
|
0
|
1
|
|
my ( $self, $email ) = @_; |
676
|
|
|
|
|
|
|
|
677
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
678
|
|
|
|
|
|
|
|
679
|
0
|
0
|
|
|
|
|
croak "Missing email" unless $email; |
680
|
|
|
|
|
|
|
|
681
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
682
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
683
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
684
|
0
|
|
|
|
|
|
my $body = { email => Webservice::OVH::Helper->trim($email) }; |
685
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'post', path => "/email/domain/$domain_name/mailingList/$mailing_list_name/sendListByEmail", body => $body, noSignature => 0 ); |
686
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
687
|
|
|
|
|
|
|
|
688
|
0
|
|
|
|
|
|
my $task_id = $response->content->{id}; |
689
|
0
|
|
|
|
|
|
my $task = Webservice::OVH::Email::Domain::Domain::Task::Mailinglist->_new_existing( wrapper => $api, domain => $self->domain, id => $task_id, module => $self->{_module} ); |
690
|
|
|
|
|
|
|
|
691
|
0
|
|
|
|
|
|
return $task; |
692
|
|
|
|
|
|
|
} |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
=head2 subscribers |
695
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
Returns an array of all subscribers or a filtered list. |
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
=over |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
=item * $email - filter for specified E-Mail address |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
=item * Synopsis: my $subscribers = $mailing_list->subscribers(); |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
=back |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
=cut |
709
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
sub subscribers { |
711
|
|
|
|
|
|
|
|
712
|
0
|
|
|
0
|
1
|
|
my ( $self, $email ) = @_; |
713
|
|
|
|
|
|
|
|
714
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
715
|
|
|
|
|
|
|
|
716
|
0
|
0
|
|
|
|
|
my $filter_email = $email ? $email : ""; |
717
|
0
|
|
|
|
|
|
my $filter = Webservice::OVH::Helper->construct_filter( "email" => $filter_email ); |
718
|
|
|
|
|
|
|
|
719
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
720
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
721
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
722
|
|
|
|
|
|
|
|
723
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => sprintf( "/email/domain/$domain_name/mailingList/$mailing_list_name/subscriber%s", $filter ), noSignature => 0 ); |
724
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
725
|
|
|
|
|
|
|
|
726
|
0
|
|
|
|
|
|
return $response->content; |
727
|
|
|
|
|
|
|
} |
728
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
=head2 subscriber |
730
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
Returns the properties of a single subscriber. |
732
|
|
|
|
|
|
|
|
733
|
|
|
|
|
|
|
=over |
734
|
|
|
|
|
|
|
|
735
|
|
|
|
|
|
|
=item * Parameter: $email - E-Mail address |
736
|
|
|
|
|
|
|
|
737
|
|
|
|
|
|
|
=item * Return: HASH |
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
=item * Synopsis: my $subscriber = $mailing_list->subscriber('sub@test.de'); |
740
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
=back |
742
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
=cut |
744
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
sub subscriber { |
746
|
|
|
|
|
|
|
|
747
|
0
|
|
|
0
|
1
|
|
my ( $self, $email ) = @_; |
748
|
|
|
|
|
|
|
|
749
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
750
|
|
|
|
|
|
|
|
751
|
0
|
0
|
|
|
|
|
croak "Missing email" unless $email; |
752
|
|
|
|
|
|
|
|
753
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
754
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
755
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
756
|
|
|
|
|
|
|
|
757
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/mailingList/$mailing_list_name/subscriber/$email", noSignature => 0 ); |
758
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
759
|
|
|
|
|
|
|
|
760
|
0
|
|
|
|
|
|
return $response->content; |
761
|
|
|
|
|
|
|
} |
762
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
=head2 add_subscriber |
764
|
|
|
|
|
|
|
|
765
|
|
|
|
|
|
|
Adds an subscriber to the mailinglist. |
766
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
=over |
768
|
|
|
|
|
|
|
|
769
|
|
|
|
|
|
|
=item * Parameter: $email - E-Mail address |
770
|
|
|
|
|
|
|
|
771
|
|
|
|
|
|
|
=item * Synopsis: $mailing_list->add_subscriber('sub@test.de'); |
772
|
|
|
|
|
|
|
|
773
|
|
|
|
|
|
|
=back |
774
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
=cut |
776
|
|
|
|
|
|
|
|
777
|
|
|
|
|
|
|
sub add_subscriber { |
778
|
|
|
|
|
|
|
|
779
|
0
|
|
|
0
|
1
|
|
my ( $self, $email ) = @_; |
780
|
|
|
|
|
|
|
|
781
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
782
|
|
|
|
|
|
|
|
783
|
0
|
0
|
|
|
|
|
croak "Missing email" unless $email; |
784
|
|
|
|
|
|
|
|
785
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
786
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
787
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
788
|
0
|
|
|
|
|
|
my $body = { email => Webservice::OVH::Helper->trim($email) }; |
789
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'post', path => "/email/domain/$domain_name/mailingList/$mailing_list_name/subscriber", body => $body, noSignature => 0 ); |
790
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
791
|
|
|
|
|
|
|
|
792
|
0
|
|
|
|
|
|
my $task_id = $response->content->{id}; |
793
|
0
|
|
|
|
|
|
my $task = Webservice::OVH::Email::Domain::Domain::Task::Mailinglist->_new_existing( wrapper => $api, domain => $self->domain, id => $task_id, module => $self->{_module} ); |
794
|
|
|
|
|
|
|
|
795
|
0
|
|
|
|
|
|
return $task; |
796
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
} |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
=head2 delete_subscriber |
800
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
Deletes an subscriber to the mailinglist. |
802
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
=over |
804
|
|
|
|
|
|
|
|
805
|
|
|
|
|
|
|
=item * Parameter: $email - E-Mail address |
806
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
=item * Synopsis: $mailing_list->delete_subscriber('sub@test.de'); |
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
=back |
810
|
|
|
|
|
|
|
|
811
|
|
|
|
|
|
|
=cut |
812
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
sub delete_subscriber { |
814
|
|
|
|
|
|
|
|
815
|
0
|
|
|
0
|
1
|
|
my ( $self, $email ) = @_; |
816
|
|
|
|
|
|
|
|
817
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
818
|
|
|
|
|
|
|
|
819
|
0
|
0
|
|
|
|
|
croak "Missing email" unless $email; |
820
|
|
|
|
|
|
|
|
821
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
822
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
823
|
0
|
|
|
|
|
|
my $mailing_list_name = $self->name; |
824
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'delete', path => "/email/domain/$domain_name/mailingList/$mailing_list_name/subscriber/$email", noSignature => 0 ); |
825
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
826
|
|
|
|
|
|
|
|
827
|
0
|
|
|
|
|
|
my $task_id = $response->content->{id}; |
828
|
0
|
|
|
|
|
|
my $task = Webservice::OVH::Email::Domain::Domain::Task::Mailinglist->_new_existing( wrapper => $api, domain => $self->domain, id => $task_id, module => $self->{_module} ); |
829
|
|
|
|
|
|
|
|
830
|
0
|
|
|
|
|
|
return $task; |
831
|
|
|
|
|
|
|
} |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
=head2 tasks |
834
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
Get all associated tasks |
836
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
=over |
838
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
=item * Return: HASH |
840
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
=item * Synopsis: $mailinglist->tasks; |
842
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
=back |
844
|
|
|
|
|
|
|
|
845
|
|
|
|
|
|
|
=cut |
846
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
sub tasks { |
848
|
|
|
|
|
|
|
|
849
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
850
|
|
|
|
|
|
|
|
851
|
0
|
0
|
|
|
|
|
return unless $self->{_valid}; |
852
|
|
|
|
|
|
|
|
853
|
0
|
|
|
|
|
|
my $domain_name = $self->domain->name; |
854
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
855
|
0
|
|
|
|
|
|
my $name = $self->name; |
856
|
|
|
|
|
|
|
|
857
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => sprintf( "/email/domain/$domain_name/task/mailinglist?account=%s", $name ), noSignature => 0 ); |
858
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
859
|
|
|
|
|
|
|
|
860
|
0
|
|
0
|
|
|
|
my $taks = $response->content || []; |
861
|
|
|
|
|
|
|
|
862
|
0
|
0
|
|
|
|
|
return unless scalar @$taks; |
863
|
|
|
|
|
|
|
|
864
|
0
|
|
|
|
|
|
return $taks; |
865
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
} |
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
1; |