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