line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::CampaignMonitor; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
264113
|
use strict; |
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
406
|
|
4
|
|
|
|
|
|
|
|
5
|
10
|
|
|
10
|
|
566
|
use 5.008005; |
|
10
|
|
|
|
|
37
|
|
|
10
|
|
|
|
|
358
|
|
6
|
10
|
|
|
10
|
|
11143
|
use MIME::Base64; |
|
10
|
|
|
|
|
9655
|
|
|
10
|
|
|
|
|
1850
|
|
7
|
10
|
|
|
10
|
|
10487
|
use REST::Client; |
|
10
|
|
|
|
|
875865
|
|
|
10
|
|
|
|
|
392
|
|
8
|
10
|
|
|
10
|
|
7460
|
use Params::Util qw{_STRING _NONNEGINT _POSINT _HASH _HASHLIKE _ARRAY}; |
|
10
|
|
|
|
|
22865
|
|
|
10
|
|
|
|
|
1028
|
|
9
|
10
|
|
|
10
|
|
10060
|
use JSON; |
|
10
|
|
|
|
|
164847
|
|
|
10
|
|
|
|
|
73
|
|
10
|
10
|
|
|
10
|
|
1567
|
use Carp; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
739
|
|
11
|
10
|
|
|
10
|
|
57
|
use URI; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
216
|
|
12
|
10
|
|
|
10
|
|
53
|
use URI::Escape; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
554
|
|
13
|
|
|
|
|
|
|
|
14
|
10
|
|
|
10
|
|
11071
|
use version; our $VERSION = version->declare("v2.2.1"); |
|
10
|
|
|
|
|
23122
|
|
|
10
|
|
|
|
|
60
|
|
15
|
|
|
|
|
|
|
our $CAMPAIGN_MONITOR_DOMAIN = 'api.createsend.com'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub authorize_url { |
18
|
2
|
|
|
2
|
1
|
1939
|
my $class = shift; |
19
|
2
|
|
|
|
|
5
|
my ($args) = @_; |
20
|
2
|
50
|
|
|
|
11
|
unless(Params::Util::_HASH($args)) { |
21
|
2
|
|
|
|
|
12
|
$args = { @_ }; |
22
|
|
|
|
|
|
|
} |
23
|
2
|
|
|
|
|
8
|
my $self = bless($args, $class); |
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
18
|
my $uri = URI->new('https://'.$Net::CampaignMonitor::CAMPAIGN_MONITOR_DOMAIN.'/oauth'); |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
10596
|
my @query = map { $_ => $self->{$_} } qw(client_id redirect_uri scope); |
|
6
|
|
|
|
|
29
|
|
28
|
2
|
100
|
|
|
|
13
|
push @query, state => $self->{state} if exists $self->{state}; |
29
|
2
|
|
|
|
|
21
|
$uri->query_form(\@query); |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
553
|
return $uri->as_string; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub exchange_token { |
35
|
1
|
|
|
1
|
1
|
928
|
my $class = shift; |
36
|
1
|
|
|
|
|
3
|
my ($args) = @_; |
37
|
1
|
50
|
|
|
|
8
|
unless(Params::Util::_HASH($args)) { |
38
|
1
|
|
|
|
|
7
|
$args = { @_ }; |
39
|
|
|
|
|
|
|
} |
40
|
1
|
|
|
|
|
3
|
my $self = bless($args, $class); |
41
|
1
|
|
|
|
|
5
|
my $oauth_client = Net::CampaignMonitor->create_oauth_client(); |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
4
|
my $body = 'grant_type=authorization_code'; |
44
|
1
|
|
|
|
|
12
|
$body .= "&$_=" . uri_escape($self->{$_}) for qw(client_id client_secret redirect_uri code); |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
111
|
$oauth_client->POST('https://'.$Net::CampaignMonitor::CAMPAIGN_MONITOR_DOMAIN.'/oauth/token', |
47
|
|
|
|
|
|
|
$body, {'Content-type' => 'application/x-www-form-urlencoded'}); |
48
|
1
|
|
|
|
|
905749
|
my $result = $self->decode($oauth_client->responseContent()); |
49
|
|
|
|
|
|
|
|
50
|
1
|
50
|
|
|
|
9
|
if (exists $result->{error}) { |
51
|
1
|
|
|
|
|
39
|
croak 'Error exchanging OAuth code for access token. '.$result->{error}.': '.$result->{error_description}; |
52
|
|
|
|
|
|
|
} |
53
|
0
|
|
|
|
|
0
|
return $result; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub new { |
57
|
2
|
|
|
2
|
1
|
2602
|
my $class = shift; |
58
|
2
|
|
|
|
|
5
|
my ($args) = @_; |
59
|
2
|
50
|
|
|
|
15
|
unless(Params::Util::_HASH($args)) { |
60
|
0
|
0
|
|
|
|
0
|
if (@_ % 2 == 0) { |
61
|
0
|
|
|
|
|
0
|
$args = { @_ }; |
62
|
|
|
|
|
|
|
} else { |
63
|
0
|
|
|
|
|
0
|
croak 'Error parsing constructor arguments, no hashref and odd number of arguments supplied'; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
2
|
|
|
|
|
5
|
my $self = bless($args, $class); |
67
|
2
|
|
|
|
|
6
|
$self->{format} = 'json'; |
68
|
2
|
|
|
|
|
98
|
$self->{useragent} = 'createsend-perl-'.$Net::CampaignMonitor::VERSION; |
69
|
2
|
50
|
|
|
|
16
|
unless( Params::Util::_STRING($self->{domain}) ) { |
70
|
2
|
|
|
|
|
7
|
$self->{domain} = $Net::CampaignMonitor::CAMPAIGN_MONITOR_DOMAIN; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
2
|
|
|
|
|
15
|
my $uri = URI->new; |
74
|
2
|
50
|
|
|
|
113
|
$self->{secure} = 1 unless defined $self->{secure}; |
75
|
2
|
50
|
|
|
|
18
|
$uri->scheme($self->{secure} ? 'https' : 'http'); |
76
|
2
|
|
|
|
|
334
|
$uri->host($self->{domain}); |
77
|
2
|
|
|
|
|
148
|
$self->{base_uri} = $uri; |
78
|
|
|
|
|
|
|
|
79
|
2
|
|
|
|
|
10
|
$self->{base_path} = ['api', 'v3']; |
80
|
|
|
|
|
|
|
|
81
|
2
|
50
|
|
|
|
84
|
unless( Params::Util::_POSINT($self->{timeout}) ) { |
82
|
2
|
|
|
|
|
17
|
$self->{timeout} = 600; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
2
|
50
|
33
|
|
|
12
|
if ( (exists $self->{api_key} ) && !( Params::Util::_STRING( $self->{api_key} )) ) { |
86
|
0
|
|
|
|
|
0
|
Carp::croak("Missing or invalid api key"); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
2
|
50
|
66
|
|
|
16
|
if ( (exists $self->{access_token} ) && !( Params::Util::_STRING( $self->{access_token} )) ) { |
90
|
0
|
|
|
|
|
0
|
Carp::croak("Missing or invalid OAuth access token"); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
2
|
100
|
66
|
|
|
17
|
if ( exists $self->{api_key} || exists $self->{access_token} ) { |
94
|
|
|
|
|
|
|
# Create and initialise the rest client |
95
|
1
|
|
|
|
|
5
|
$self->{client} = $self->create_rest_client(); |
96
|
1
|
|
|
|
|
6
|
$self->account_systemdate(); |
97
|
1
|
|
|
|
|
11
|
return $self; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
else { |
100
|
1
|
|
|
|
|
4
|
return $self; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub create_rest_client { |
105
|
1
|
|
|
1
|
0
|
4
|
my ($self) = @_; |
106
|
|
|
|
|
|
|
|
107
|
1
|
|
|
|
|
10
|
my $ua = LWP::UserAgent->new; |
108
|
1
|
|
|
|
|
323
|
$ua->agent($self->{useragent}); |
109
|
1
|
50
|
|
|
|
62
|
if (exists $self->{access_token}) { |
|
|
0
|
|
|
|
|
|
110
|
1
|
|
|
|
|
16
|
$ua->default_header('Authorization' => 'Bearer '.$self->{access_token}); |
111
|
|
|
|
|
|
|
} elsif (exists $self->{api_key}) { |
112
|
0
|
|
|
|
|
0
|
$ua->default_header('Authorization' => 'Basic '.encode_base64($self->{api_key}.':x')); |
113
|
|
|
|
|
|
|
} |
114
|
1
|
|
|
|
|
62
|
my $client = REST::Client->new({useragent => $ua}); |
115
|
1
|
|
|
|
|
92
|
$client->setFollow(1); |
116
|
1
|
|
|
|
|
36
|
$client->setTimeout($self->{timeout}); |
117
|
1
|
|
|
|
|
9
|
return $client; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub create_oauth_client { |
121
|
2
|
|
|
2
|
0
|
18
|
my $ua = LWP::UserAgent->new; |
122
|
2
|
|
|
|
|
5064
|
my $client = REST::Client->new({useragent => $ua}); |
123
|
2
|
|
|
|
|
2548
|
$client->setFollow(1); |
124
|
2
|
|
|
|
|
59
|
$client->setTimeout(600); |
125
|
2
|
|
|
|
|
16
|
return $client; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub refresh_token { |
129
|
2
|
|
|
2
|
1
|
100
|
my ($self) = @_; |
130
|
|
|
|
|
|
|
|
131
|
2
|
100
|
33
|
|
|
23
|
if (!exists $self->{refresh_token} || |
|
|
|
66
|
|
|
|
|
132
|
|
|
|
|
|
|
(exists $self->{refresh_token} && !(Params::Util::_STRING($self->{refresh_token})))) { |
133
|
1
|
|
|
|
|
13
|
croak 'Error refreshing OAuth token. No refresh token exists.'; |
134
|
|
|
|
|
|
|
} |
135
|
1
|
|
|
|
|
9
|
my $oauth_client = Net::CampaignMonitor->create_oauth_client(); |
136
|
1
|
|
|
|
|
6
|
my $body = 'grant_type=refresh_token&refresh_token='.uri_escape($self->{refresh_token}); |
137
|
1
|
|
|
|
|
34
|
$oauth_client->POST('https://'.$Net::CampaignMonitor::CAMPAIGN_MONITOR_DOMAIN.'/oauth/token', $body, |
138
|
|
|
|
|
|
|
{'Content-type' => 'application/x-www-form-urlencoded'}); |
139
|
1
|
|
|
|
|
457501
|
my $result = $self->decode($oauth_client->responseContent()); |
140
|
|
|
|
|
|
|
|
141
|
1
|
50
|
|
|
|
9
|
if (exists $result->{error}) { |
142
|
1
|
|
|
|
|
51
|
croak 'Error refreshing OAuth token. '.$result->{error}.': '.$result->{error_description}; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# Set the access token and refresh token, and re-create the client |
146
|
0
|
|
|
|
|
0
|
$self->{access_token} = $result->{access_token}; |
147
|
0
|
|
|
|
|
0
|
$self->{refresh_token} = $result->{refresh_token}; |
148
|
0
|
|
|
|
|
0
|
$self->{client} = $self->create_rest_client(); |
149
|
0
|
|
|
|
|
0
|
return $result; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub decode { |
153
|
3
|
|
|
3
|
0
|
573
|
my $self = shift; |
154
|
3
|
|
|
|
|
78
|
my $json = JSON->new->allow_nonref; |
155
|
|
|
|
|
|
|
|
156
|
3
|
50
|
|
|
|
19
|
if ( length $_[0] == 0 ) { |
157
|
0
|
|
|
|
|
0
|
return {}; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
else { |
160
|
3
|
|
|
|
|
71
|
return $json->decode( $_[0] ); |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub account_systemdate { |
165
|
1
|
|
|
1
|
1
|
5
|
my ($self) = @_; |
166
|
1
|
|
|
|
|
5
|
$self->_rest(GET => 'systemdate'); |
167
|
|
|
|
|
|
|
|
168
|
1
|
|
|
|
|
442844
|
return $self->_build_results(); |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub account_billingdetails { |
172
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
173
|
0
|
|
|
|
|
0
|
$self->_rest(GET => 'billingdetails'); |
174
|
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub account_clients { |
179
|
0
|
0
|
|
0
|
1
|
0
|
if (scalar(@_) == 1) { # Get the list of clients |
180
|
0
|
|
|
|
|
0
|
my ($self) = @_; |
181
|
0
|
|
|
|
|
0
|
$self->_rest(GET => 'clients'); |
182
|
|
|
|
|
|
|
|
183
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
else { # Create a new client |
186
|
0
|
|
|
|
|
0
|
my ($self, %request) = @_; |
187
|
|
|
|
|
|
|
|
188
|
0
|
|
|
|
|
0
|
$self->_rest(POST => 'clients', undef, \%request); |
189
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
sub account_countries { |
195
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
196
|
0
|
|
|
|
|
0
|
$self->_rest(GET => 'countries'); |
197
|
|
|
|
|
|
|
|
198
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub account_timezones { |
202
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
203
|
0
|
|
|
|
|
0
|
$self->_rest(GET => 'timezones'); |
204
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub account_apikey { |
209
|
0
|
|
|
0
|
1
|
0
|
my ($self, $siteurl, $username, $password) = @_; |
210
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
0
|
my $ua = LWP::UserAgent->new; |
212
|
0
|
|
|
|
|
0
|
$ua->agent($self->{useragent}); |
213
|
0
|
|
|
|
|
0
|
$ua->default_header('Authorization' => 'Basic '.encode_base64($username.':'.$password)); |
214
|
0
|
|
|
|
|
0
|
my $api_client = REST::Client->new({useragent => $ua}); |
215
|
|
|
|
|
|
|
|
216
|
0
|
|
|
|
|
0
|
$api_client->setFollow(1); |
217
|
0
|
|
|
|
|
0
|
$api_client->setTimeout(60); |
218
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
0
|
my $uri = $self->_build_uri('format', { siteurl => $siteurl }); |
220
|
0
|
|
|
|
|
0
|
$api_client->GET($uri->as_string); |
221
|
|
|
|
|
|
|
|
222
|
0
|
|
|
|
|
0
|
return $self->_build_results($api_client); |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
sub account_addadmin{ |
226
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
227
|
|
|
|
|
|
|
|
228
|
0
|
|
|
|
|
0
|
$self->_rest(POST => 'admins', undef, \%request); |
229
|
|
|
|
|
|
|
|
230
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
sub account_updateadmin{ |
234
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
235
|
0
|
|
|
|
|
0
|
my $email = delete $request{email}; |
236
|
|
|
|
|
|
|
|
237
|
0
|
|
|
|
|
0
|
my $json_request = encode_json \%request; |
238
|
|
|
|
|
|
|
|
239
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => 'admins', { email => $email }, $json_request); |
240
|
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub account_getadmins { |
245
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
246
|
0
|
|
|
|
|
0
|
$self->_rest(GET => 'admins'); |
247
|
|
|
|
|
|
|
|
248
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
sub account_getadmin { |
252
|
0
|
|
|
0
|
1
|
0
|
my ($self, $email) = @_; |
253
|
|
|
|
|
|
|
|
254
|
0
|
|
|
|
|
0
|
$self->_rest(GET => 'admins', { email => $email }); |
255
|
|
|
|
|
|
|
|
256
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
sub account_deleteadmin { |
260
|
0
|
|
|
0
|
1
|
0
|
my ($self, $email) = @_; |
261
|
|
|
|
|
|
|
|
262
|
0
|
|
|
|
|
0
|
$self->_rest(DELETE => 'admins', { email => $email }); |
263
|
|
|
|
|
|
|
|
264
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
sub account_setprimarycontact { |
268
|
0
|
|
|
0
|
0
|
0
|
my ($self, $email) = @_; |
269
|
|
|
|
|
|
|
|
270
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => 'primarycontact', { email => $email }); |
271
|
|
|
|
|
|
|
|
272
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
sub account_getprimarycontact { |
276
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
277
|
|
|
|
|
|
|
|
278
|
0
|
|
|
|
|
0
|
$self->_rest(GET => 'primarycontact'); |
279
|
|
|
|
|
|
|
|
280
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
281
|
|
|
|
|
|
|
} |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
sub account_externalsession { |
284
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
285
|
|
|
|
|
|
|
|
286
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => 'externalsession', undef, \%request); |
287
|
|
|
|
|
|
|
|
288
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
sub client_clientid { |
292
|
0
|
|
|
0
|
1
|
0
|
my ($self, $client_id) = @_; |
293
|
|
|
|
|
|
|
|
294
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ clients => $client_id ]); |
295
|
|
|
|
|
|
|
|
296
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
sub client_campaigns { |
300
|
0
|
|
|
0
|
1
|
0
|
my ($self, $client_id) = @_; |
301
|
|
|
|
|
|
|
|
302
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ clients => $client_id, 'campaigns' ]); |
303
|
|
|
|
|
|
|
|
304
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
305
|
|
|
|
|
|
|
} |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
sub client_drafts { |
308
|
0
|
|
|
0
|
1
|
0
|
my ($self, $client_id) = @_; |
309
|
|
|
|
|
|
|
|
310
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ clients => $client_id, 'drafts' ]); |
311
|
|
|
|
|
|
|
|
312
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
sub client_scheduled { |
316
|
0
|
|
|
0
|
0
|
0
|
my ($self, $client_id) = @_; |
317
|
|
|
|
|
|
|
|
318
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ clients => $client_id, 'scheduled' ]); |
319
|
|
|
|
|
|
|
|
320
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
sub client_lists { |
324
|
0
|
|
|
0
|
1
|
0
|
my ($self, $client_id) = @_; |
325
|
|
|
|
|
|
|
|
326
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ clients => $client_id, 'lists' ]); |
327
|
|
|
|
|
|
|
|
328
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
sub client_listsforemail { |
332
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
333
|
0
|
|
|
|
|
0
|
my $client_id = $request{clientid}; |
334
|
0
|
|
|
|
|
0
|
my $email = $request{email}; |
335
|
|
|
|
|
|
|
|
336
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ clients => $client_id, 'listsforemail' ], { email => $email }); |
337
|
|
|
|
|
|
|
|
338
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
339
|
|
|
|
|
|
|
} |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
sub client_segments { |
342
|
0
|
|
|
0
|
1
|
0
|
my ($self, $client_id) = @_; |
343
|
|
|
|
|
|
|
|
344
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ clients => $client_id, 'segments' ]); |
345
|
|
|
|
|
|
|
|
346
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
sub client_suppressionlist { |
350
|
0
|
|
|
0
|
0
|
0
|
my ($self, %input) = @_; |
351
|
0
|
|
|
|
|
0
|
my $client_id = delete $input{clientid}; |
352
|
|
|
|
|
|
|
|
353
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
354
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
355
|
|
|
|
|
|
|
} |
356
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
357
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
358
|
|
|
|
|
|
|
} |
359
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
360
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'email'; |
361
|
|
|
|
|
|
|
} |
362
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
363
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
|
366
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ clients => $client_id, 'suppressionlist' ], \%input); |
367
|
|
|
|
|
|
|
|
368
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
369
|
|
|
|
|
|
|
} |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
sub client_suppress { |
372
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
373
|
0
|
|
|
|
|
0
|
my $client_id = delete $request{clientid}; |
374
|
|
|
|
|
|
|
|
375
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ clients => $client_id, 'suppress' ], undef, \%request); |
376
|
|
|
|
|
|
|
|
377
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
sub client_unsuppress { |
381
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
382
|
0
|
|
|
|
|
0
|
my $client_id = delete $request{clientid}; |
383
|
0
|
|
|
|
|
0
|
my $email = delete $request{email}; |
384
|
|
|
|
|
|
|
|
385
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ clients => $client_id, 'unsuppress' ], { email => $email }, \%request); |
386
|
|
|
|
|
|
|
|
387
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
388
|
|
|
|
|
|
|
} |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
sub client_templates { |
391
|
0
|
|
|
0
|
1
|
0
|
my ($self, $client_id) = @_; |
392
|
|
|
|
|
|
|
|
393
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ clients => $client_id, 'templates' ]); |
394
|
|
|
|
|
|
|
|
395
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
396
|
|
|
|
|
|
|
} |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
sub client_setbasics { |
399
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
400
|
0
|
|
|
|
|
0
|
my $client_id = delete $request{clientid}; |
401
|
|
|
|
|
|
|
|
402
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ clients => $client_id, 'setbasics' ], undef, \%request); |
403
|
|
|
|
|
|
|
|
404
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
405
|
|
|
|
|
|
|
} |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
sub client_setpaygbilling { |
408
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
409
|
0
|
|
|
|
|
0
|
my $client_id = delete $request{clientid}; |
410
|
|
|
|
|
|
|
|
411
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ clients => $client_id, 'setpaygbilling' ], undef, \%request); |
412
|
|
|
|
|
|
|
|
413
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
414
|
|
|
|
|
|
|
} |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
sub client_setmonthlybilling { |
417
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
418
|
0
|
|
|
|
|
0
|
my $client_id = delete $request{clientid}; |
419
|
|
|
|
|
|
|
|
420
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ clients => $client_id, 'setmonthlybilling' ], undef, \%request); |
421
|
|
|
|
|
|
|
|
422
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
423
|
|
|
|
|
|
|
} |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
sub client_transfercredits { |
426
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
427
|
0
|
|
|
|
|
0
|
my $client_id = delete $request{clientid}; |
428
|
|
|
|
|
|
|
|
429
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ clients => $client_id, 'credits' ], undef, \%request); |
430
|
|
|
|
|
|
|
|
431
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
432
|
|
|
|
|
|
|
} |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
sub client_delete { |
435
|
0
|
|
|
0
|
1
|
0
|
my ($self, $client_id) = @_; |
436
|
|
|
|
|
|
|
|
437
|
0
|
|
|
|
|
0
|
$self->_rest(DELETE => [ clients => $client_id ]); |
438
|
|
|
|
|
|
|
|
439
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
440
|
|
|
|
|
|
|
} |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
sub client_addperson { |
443
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
444
|
0
|
|
|
|
|
0
|
my $client_id = delete $request{clientid}; |
445
|
|
|
|
|
|
|
|
446
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ clients => $client_id, 'people' ], undef, \%request); |
447
|
|
|
|
|
|
|
|
448
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
449
|
|
|
|
|
|
|
} |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
sub client_updateperson { |
452
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
453
|
0
|
|
|
|
|
0
|
my $client_id = delete $request{clientid}; |
454
|
0
|
|
|
|
|
0
|
my $email = delete $request{email}; |
455
|
|
|
|
|
|
|
|
456
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ clients => $client_id, 'people' ], { email => $email }, \%request); |
457
|
|
|
|
|
|
|
|
458
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
459
|
|
|
|
|
|
|
} |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
sub client_getpeople { |
462
|
0
|
|
|
0
|
1
|
0
|
my ($self, $client_id) = @_; |
463
|
|
|
|
|
|
|
|
464
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ clients => $client_id, 'people' ]); |
465
|
|
|
|
|
|
|
|
466
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
467
|
|
|
|
|
|
|
} |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
sub client_getperson { |
470
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
471
|
0
|
|
|
|
|
0
|
my $client_id = $request{clientid}; |
472
|
0
|
|
|
|
|
0
|
my $email = $request{email}; |
473
|
|
|
|
|
|
|
|
474
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ clients => $client_id, 'people' ], { email => $email }); |
475
|
|
|
|
|
|
|
|
476
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
477
|
|
|
|
|
|
|
} |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
sub client_deleteperson { |
480
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
481
|
0
|
|
|
|
|
0
|
my $client_id = $request{clientid}; |
482
|
0
|
|
|
|
|
0
|
my $email = $request{email}; |
483
|
|
|
|
|
|
|
|
484
|
0
|
|
|
|
|
0
|
$self->_rest(DELETE => [ clients => $client_id, 'people' ], { email => $email }); |
485
|
|
|
|
|
|
|
|
486
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
487
|
|
|
|
|
|
|
} |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
sub client_setprimarycontact { |
490
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
491
|
0
|
|
|
|
|
0
|
my $client_id = $request{clientid}; |
492
|
0
|
|
|
|
|
0
|
my $email = $request{email}; |
493
|
|
|
|
|
|
|
|
494
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ clients => $client_id, 'primarycontact' ], { email => $email }); |
495
|
|
|
|
|
|
|
|
496
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
497
|
|
|
|
|
|
|
} |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
sub client_getprimarycontact { |
500
|
0
|
|
|
0
|
1
|
0
|
my ($self, $client_id) = @_; |
501
|
|
|
|
|
|
|
|
502
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ clients => $client_id, 'primarycontact' ]); |
503
|
|
|
|
|
|
|
|
504
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
sub lists { # Create a list |
508
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
509
|
0
|
|
|
|
|
0
|
my $client_id = delete $request{clientid}; |
510
|
|
|
|
|
|
|
|
511
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ lists => $client_id ], undef, \%request); |
512
|
|
|
|
|
|
|
|
513
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
514
|
|
|
|
|
|
|
} |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
sub list_listid { |
517
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
518
|
|
|
|
|
|
|
|
519
|
0
|
0
|
|
|
|
0
|
if ( @_ == 1 ) { # Get the list details |
520
|
0
|
|
|
|
|
0
|
my $list_id = $_[0]; |
521
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ lists => $list_id ]); |
522
|
|
|
|
|
|
|
|
523
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
524
|
|
|
|
|
|
|
} |
525
|
|
|
|
|
|
|
else { # Updating a list |
526
|
0
|
|
|
|
|
0
|
my (%request) = @_; |
527
|
0
|
|
|
|
|
0
|
my $list_id = delete $request{listid}; |
528
|
|
|
|
|
|
|
|
529
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ lists => $list_id ], undef, \%request); |
530
|
|
|
|
|
|
|
|
531
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
532
|
|
|
|
|
|
|
} |
533
|
|
|
|
|
|
|
} |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
sub list_stats { |
536
|
0
|
|
|
0
|
1
|
0
|
my ($self, $list_id) = @_; |
537
|
|
|
|
|
|
|
|
538
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ lists => $list_id, 'stats' ]); |
539
|
|
|
|
|
|
|
|
540
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
541
|
|
|
|
|
|
|
} |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
sub list_customfields { |
544
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
545
|
|
|
|
|
|
|
|
546
|
0
|
0
|
|
|
|
0
|
if (scalar(@_) == 1) { # Get the custom field details |
547
|
0
|
|
|
|
|
0
|
my $list_id = $_[0]; |
548
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ lists => $list_id, 'customfields' ]); |
549
|
|
|
|
|
|
|
|
550
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
551
|
|
|
|
|
|
|
} |
552
|
|
|
|
|
|
|
else { # Create a new custom field |
553
|
0
|
|
|
|
|
0
|
my (%request) = @_; |
554
|
0
|
|
|
|
|
0
|
my $list_id = delete $request{listid}; |
555
|
|
|
|
|
|
|
|
556
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ lists => $list_id, 'customfields' ], undef, \%request); |
557
|
|
|
|
|
|
|
|
558
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
559
|
|
|
|
|
|
|
} |
560
|
|
|
|
|
|
|
} |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
sub list_customfields_update { |
563
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
564
|
0
|
|
|
|
|
0
|
my $list_id = delete $request{listid}; |
565
|
0
|
|
|
|
|
0
|
my $key = delete $request{customfieldkey}; |
566
|
|
|
|
|
|
|
|
567
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ lists => $list_id, customfields => $key ], undef, \%request); |
568
|
|
|
|
|
|
|
|
569
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
570
|
|
|
|
|
|
|
} |
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
sub list_segments { |
573
|
0
|
|
|
0
|
1
|
0
|
my ($self, $list_id) = @_; |
574
|
|
|
|
|
|
|
|
575
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ lists => $list_id, 'segments' ]); |
576
|
|
|
|
|
|
|
|
577
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
578
|
|
|
|
|
|
|
} |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
sub list_active { |
581
|
0
|
|
|
0
|
1
|
0
|
my ($self, %input) = @_; |
582
|
0
|
|
|
|
|
0
|
my $list_id = delete $input{listid}; |
583
|
|
|
|
|
|
|
|
584
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_STRING($input{date}) ) { |
585
|
0
|
|
|
|
|
0
|
$input{date} = ''; |
586
|
|
|
|
|
|
|
} |
587
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
588
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
589
|
|
|
|
|
|
|
} |
590
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
591
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
592
|
|
|
|
|
|
|
} |
593
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
594
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'date'; |
595
|
|
|
|
|
|
|
} |
596
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
597
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
598
|
|
|
|
|
|
|
} |
599
|
|
|
|
|
|
|
|
600
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ lists => $list_id, 'active' ], \%input); |
601
|
|
|
|
|
|
|
|
602
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
603
|
|
|
|
|
|
|
} |
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
sub list_unconfirmed { |
606
|
0
|
|
|
0
|
1
|
0
|
my ($self, %input) = @_; |
607
|
0
|
|
|
|
|
0
|
my $list_id = delete $input{listid}; |
608
|
|
|
|
|
|
|
|
609
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_STRING($input{date}) ) { |
610
|
0
|
|
|
|
|
0
|
$input{date} = ''; |
611
|
|
|
|
|
|
|
} |
612
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
613
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
614
|
|
|
|
|
|
|
} |
615
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
616
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
617
|
|
|
|
|
|
|
} |
618
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
619
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'date'; |
620
|
|
|
|
|
|
|
} |
621
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
622
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
623
|
|
|
|
|
|
|
} |
624
|
|
|
|
|
|
|
|
625
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ lists => $list_id, 'active' ], \%input); |
626
|
|
|
|
|
|
|
|
627
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
628
|
|
|
|
|
|
|
} |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
sub list_unsubscribed { |
631
|
0
|
|
|
0
|
1
|
0
|
my ($self, %input) = @_; |
632
|
0
|
|
|
|
|
0
|
my $list_id = delete $input{listid}; |
633
|
|
|
|
|
|
|
|
634
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_STRING($input{date}) ) { |
635
|
0
|
|
|
|
|
0
|
$input{date} = ''; |
636
|
|
|
|
|
|
|
} |
637
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
638
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
639
|
|
|
|
|
|
|
} |
640
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
641
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
642
|
|
|
|
|
|
|
} |
643
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
644
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'date'; |
645
|
|
|
|
|
|
|
} |
646
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
647
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
648
|
|
|
|
|
|
|
} |
649
|
|
|
|
|
|
|
|
650
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ lists => $list_id, 'unsubscribed' ], \%input); |
651
|
|
|
|
|
|
|
|
652
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
653
|
|
|
|
|
|
|
} |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
sub list_deleted { |
656
|
0
|
|
|
0
|
1
|
0
|
my ($self, %input) = @_; |
657
|
0
|
|
|
|
|
0
|
my $list_id = delete $input{listid}; |
658
|
|
|
|
|
|
|
|
659
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_STRING($input{date}) ) { |
660
|
0
|
|
|
|
|
0
|
$input{date} = ''; |
661
|
|
|
|
|
|
|
} |
662
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
663
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
664
|
|
|
|
|
|
|
} |
665
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
666
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
667
|
|
|
|
|
|
|
} |
668
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
669
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'date'; |
670
|
|
|
|
|
|
|
} |
671
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
672
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
673
|
|
|
|
|
|
|
} |
674
|
|
|
|
|
|
|
|
675
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ lists => $list_id, 'deleted' ], \%input); |
676
|
|
|
|
|
|
|
|
677
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
678
|
|
|
|
|
|
|
} |
679
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
sub list_bounced { |
681
|
0
|
|
|
0
|
1
|
0
|
my ($self, %input) = @_; |
682
|
0
|
|
|
|
|
0
|
my $list_id = delete $input{listid}; |
683
|
|
|
|
|
|
|
|
684
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_STRING($input{date}) ) { |
685
|
0
|
|
|
|
|
0
|
$input{date} = ''; |
686
|
|
|
|
|
|
|
} |
687
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
688
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
689
|
|
|
|
|
|
|
} |
690
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
691
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
692
|
|
|
|
|
|
|
} |
693
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
694
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'date'; |
695
|
|
|
|
|
|
|
} |
696
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
697
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
698
|
|
|
|
|
|
|
} |
699
|
|
|
|
|
|
|
|
700
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ lists => $list_id, 'bounced' ], \%input); |
701
|
|
|
|
|
|
|
|
702
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
703
|
|
|
|
|
|
|
} |
704
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
sub list_options { |
706
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
707
|
0
|
|
|
|
|
0
|
my $list_id = delete $request{listid}; |
708
|
0
|
|
|
|
|
0
|
my $customfield_key = delete $request{customfieldkey}; |
709
|
|
|
|
|
|
|
|
710
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ lists => $list_id, customfields => $customfield_key, 'options' ], undef, \%request); |
711
|
|
|
|
|
|
|
|
712
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
713
|
|
|
|
|
|
|
} |
714
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
sub list_delete_customfieldkey { |
716
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
717
|
0
|
|
|
|
|
0
|
my $list_id = $request{listid}; |
718
|
0
|
|
|
|
|
0
|
my $customfield_key = $request{customfieldkey}; |
719
|
|
|
|
|
|
|
|
720
|
0
|
|
|
|
|
0
|
$self->_rest(DELETE => [ lists => $list_id, customfields => $customfield_key ]); |
721
|
|
|
|
|
|
|
|
722
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
723
|
|
|
|
|
|
|
} |
724
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
sub list_delete { |
726
|
0
|
|
|
0
|
1
|
0
|
my ($self, $list_id) = @_; |
727
|
|
|
|
|
|
|
|
728
|
0
|
|
|
|
|
0
|
$self->_rest(DELETE => [ lists => $list_id ]); |
729
|
|
|
|
|
|
|
|
730
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
731
|
|
|
|
|
|
|
} |
732
|
|
|
|
|
|
|
|
733
|
|
|
|
|
|
|
sub list_webhooks { |
734
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
735
|
|
|
|
|
|
|
|
736
|
0
|
0
|
|
|
|
0
|
if (scalar(@_) == 1) { #get the list of webhooks |
737
|
0
|
|
|
|
|
0
|
my $list_id = $_[0]; |
738
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ lists => $list_id, 'webhooks' ]); |
739
|
|
|
|
|
|
|
|
740
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
741
|
|
|
|
|
|
|
} |
742
|
|
|
|
|
|
|
else { #create a new webhook |
743
|
0
|
|
|
|
|
0
|
my (%request) = @_; |
744
|
0
|
|
|
|
|
0
|
my $list_id = delete $request{listid}; |
745
|
|
|
|
|
|
|
|
746
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ lists => $list_id, 'webhooks' ], undef, \%request); |
747
|
|
|
|
|
|
|
|
748
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
749
|
|
|
|
|
|
|
} |
750
|
|
|
|
|
|
|
} |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
sub list_test { |
753
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
754
|
0
|
|
|
|
|
0
|
my $list_id = $request{listid}; |
755
|
0
|
|
|
|
|
0
|
my $webhook_id = $request{webhookid}; |
756
|
|
|
|
|
|
|
|
757
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ lists => $list_id, webhooks => $webhook_id, 'test' ]); |
758
|
|
|
|
|
|
|
|
759
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
760
|
|
|
|
|
|
|
} |
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
sub list_delete_webhook { |
763
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
764
|
0
|
|
|
|
|
0
|
my $list_id = $request{listid}; |
765
|
0
|
|
|
|
|
0
|
my $webhook_id = $request{webhookid}; |
766
|
|
|
|
|
|
|
|
767
|
0
|
|
|
|
|
0
|
$self->_rest(DELETE => [ lists => $list_id, webhooks => $webhook_id ]); |
768
|
|
|
|
|
|
|
|
769
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
770
|
|
|
|
|
|
|
} |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
sub list_activate { |
773
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
774
|
0
|
|
|
|
|
0
|
my $list_id = $request{listid}; |
775
|
0
|
|
|
|
|
0
|
my $webhook_id = $request{webhookid}; |
776
|
|
|
|
|
|
|
|
777
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ lists => $list_id, webhooks => $webhook_id, 'activate' ]); |
778
|
|
|
|
|
|
|
|
779
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
780
|
|
|
|
|
|
|
} |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
sub list_deactivate { |
783
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
784
|
0
|
|
|
|
|
0
|
my $list_id = $request{listid}; |
785
|
0
|
|
|
|
|
0
|
my $webhook_id = $request{webhookid}; |
786
|
|
|
|
|
|
|
|
787
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ lists => $list_id, webhooks => $webhook_id, 'deactivate' ]); |
788
|
|
|
|
|
|
|
|
789
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
790
|
|
|
|
|
|
|
} |
791
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
sub segments { |
793
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
794
|
0
|
|
|
|
|
0
|
my $list_id = delete $request{listid}; |
795
|
|
|
|
|
|
|
|
796
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ segments => $list_id ], undef, \%request); |
797
|
|
|
|
|
|
|
|
798
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
799
|
|
|
|
|
|
|
} |
800
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
sub segment_segmentid { |
802
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
803
|
|
|
|
|
|
|
|
804
|
0
|
0
|
|
|
|
0
|
if (scalar(@_) == 1) { #get the segment details |
805
|
0
|
|
|
|
|
0
|
my $segment_id = $_[0]; |
806
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ segments => $segment_id ]); |
807
|
|
|
|
|
|
|
|
808
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
809
|
|
|
|
|
|
|
} |
810
|
|
|
|
|
|
|
else { #update the segment |
811
|
0
|
|
|
|
|
0
|
my (%request) = @_; |
812
|
0
|
|
|
|
|
0
|
my $segment_id = delete $request{segmentid}; |
813
|
|
|
|
|
|
|
|
814
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ segments => $segment_id ], undef, \%request); |
815
|
|
|
|
|
|
|
|
816
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
817
|
|
|
|
|
|
|
} |
818
|
|
|
|
|
|
|
} |
819
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
sub segment_rules { |
821
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
822
|
0
|
|
|
|
|
0
|
my $segment_id = delete $request{segmentid}; |
823
|
|
|
|
|
|
|
|
824
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ segments => $segment_id, 'rules' ], undef, \%request); |
825
|
|
|
|
|
|
|
|
826
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
827
|
|
|
|
|
|
|
} |
828
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
sub segment_active { |
830
|
0
|
|
|
0
|
1
|
0
|
my ($self, %input) = @_; |
831
|
0
|
|
|
|
|
0
|
my $segment_id = delete $input{segmentid}; |
832
|
|
|
|
|
|
|
|
833
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_STRING($input{date}) ) { |
834
|
0
|
|
|
|
|
0
|
$input{date} = ''; |
835
|
|
|
|
|
|
|
} |
836
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
837
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
838
|
|
|
|
|
|
|
} |
839
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
840
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
841
|
|
|
|
|
|
|
} |
842
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
843
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'date'; |
844
|
|
|
|
|
|
|
} |
845
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
846
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
847
|
|
|
|
|
|
|
} |
848
|
|
|
|
|
|
|
|
849
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ segments => $segment_id, 'active' ], \%input); |
850
|
|
|
|
|
|
|
|
851
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
852
|
|
|
|
|
|
|
} |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
sub segment_delete { |
855
|
0
|
|
|
0
|
1
|
0
|
my ($self, $segment_id) = @_; |
856
|
|
|
|
|
|
|
|
857
|
0
|
|
|
|
|
0
|
$self->_rest(DELETE => [ segments => $segment_id ]); |
858
|
|
|
|
|
|
|
|
859
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
860
|
|
|
|
|
|
|
} |
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
sub segment_delete_rules { |
863
|
0
|
|
|
0
|
1
|
0
|
my ($self, $segment_id) = @_; |
864
|
|
|
|
|
|
|
|
865
|
0
|
|
|
|
|
0
|
$self->_rest(DELETE => [ segments => $segment_id, 'rules' ]); |
866
|
|
|
|
|
|
|
|
867
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
868
|
|
|
|
|
|
|
} |
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
sub subscribers { |
871
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
872
|
0
|
|
|
|
|
0
|
my $list_id = delete $request{listid}; |
873
|
|
|
|
|
|
|
|
874
|
0
|
0
|
|
|
|
0
|
if ($request{email}) { # Get subscribers details |
875
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ subscribers => $list_id ], { email => $request{email} }); |
876
|
|
|
|
|
|
|
|
877
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
878
|
|
|
|
|
|
|
} |
879
|
|
|
|
|
|
|
else { # Add subscriber |
880
|
|
|
|
|
|
|
|
881
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ subscribers => $list_id ], undef, \%request); |
882
|
|
|
|
|
|
|
|
883
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
884
|
|
|
|
|
|
|
} |
885
|
|
|
|
|
|
|
} |
886
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
sub subscribers_update { |
888
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
889
|
0
|
|
|
|
|
0
|
my $list_id = delete $request{listid}; |
890
|
0
|
|
|
|
|
0
|
my $email = delete $request{email}; |
891
|
|
|
|
|
|
|
|
892
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ subscribers => $list_id ], { email => $email }, \%request); |
893
|
|
|
|
|
|
|
|
894
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
895
|
|
|
|
|
|
|
} |
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
sub subscribers_import { |
898
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
899
|
0
|
|
|
|
|
0
|
my $list_id = delete $request{listid}; |
900
|
|
|
|
|
|
|
|
901
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ subscribers => $list_id, 'import' ], undef, \%request); |
902
|
|
|
|
|
|
|
|
903
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
904
|
|
|
|
|
|
|
} |
905
|
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
sub subscribers_history { |
907
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
908
|
0
|
|
|
|
|
0
|
my $list_id = $request{listid}; |
909
|
0
|
|
|
|
|
0
|
my $email = $request{email}; |
910
|
|
|
|
|
|
|
|
911
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ subscribers => $list_id, 'history' ], { email => $email }); |
912
|
|
|
|
|
|
|
|
913
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
914
|
|
|
|
|
|
|
} |
915
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
sub subscribers_unsubscribe { |
917
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
918
|
0
|
|
|
|
|
0
|
my $list_id = delete $request{listid}; |
919
|
|
|
|
|
|
|
|
920
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ subscribers => $list_id, 'unsubscribe' ], undef, \%request); |
921
|
|
|
|
|
|
|
|
922
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
923
|
|
|
|
|
|
|
} |
924
|
|
|
|
|
|
|
|
925
|
|
|
|
|
|
|
sub subscribers_delete { |
926
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
927
|
0
|
|
|
|
|
0
|
my $list_id = $request{listid}; |
928
|
0
|
|
|
|
|
0
|
my $email = $request{email}; |
929
|
|
|
|
|
|
|
|
930
|
0
|
|
|
|
|
0
|
$self->_rest(DELETE => [ subscribers => $list_id ], { email => $email }); |
931
|
|
|
|
|
|
|
|
932
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
933
|
|
|
|
|
|
|
} |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
sub templates { |
936
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
937
|
|
|
|
|
|
|
|
938
|
0
|
0
|
|
|
|
0
|
if ( @_ == 1 ) { #get the template details |
939
|
0
|
|
|
|
|
0
|
my $template_id = $_[0]; |
940
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ templates => $template_id ]); |
941
|
|
|
|
|
|
|
|
942
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
943
|
|
|
|
|
|
|
} |
944
|
|
|
|
|
|
|
else { |
945
|
0
|
|
|
|
|
0
|
my (%request) = @_; |
946
|
0
|
0
|
|
|
|
0
|
if ( $request{templateid} ) { #update the template |
|
|
0
|
|
|
|
|
|
947
|
0
|
|
|
|
|
0
|
my $template_id = delete $request{templateid}; |
948
|
|
|
|
|
|
|
|
949
|
0
|
|
|
|
|
0
|
$self->_rest(PUT => [ templates => $template_id ], undef, \%request); |
950
|
|
|
|
|
|
|
|
951
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
952
|
|
|
|
|
|
|
} |
953
|
|
|
|
|
|
|
elsif ( $request{clientid} ) { #create a template |
954
|
0
|
|
|
|
|
0
|
my $client_id = delete $request{clientid}; |
955
|
|
|
|
|
|
|
|
956
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ templates => $client_id ], undef, \%request); |
957
|
|
|
|
|
|
|
|
958
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
959
|
|
|
|
|
|
|
} |
960
|
|
|
|
|
|
|
} |
961
|
|
|
|
|
|
|
} |
962
|
|
|
|
|
|
|
|
963
|
|
|
|
|
|
|
sub templates_delete { |
964
|
0
|
|
|
0
|
1
|
0
|
my ($self, $template_id) = @_; |
965
|
|
|
|
|
|
|
|
966
|
0
|
|
|
|
|
0
|
$self->_rest(DELETE => [ templates => $template_id ]); |
967
|
|
|
|
|
|
|
|
968
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
969
|
|
|
|
|
|
|
} |
970
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
sub campaigns { |
972
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
973
|
0
|
|
|
|
|
0
|
my $client_id = delete $request{clientid}; |
974
|
|
|
|
|
|
|
|
975
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ campaigns => $client_id ], undef, \%request); |
976
|
|
|
|
|
|
|
|
977
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
978
|
|
|
|
|
|
|
} |
979
|
|
|
|
|
|
|
|
980
|
|
|
|
|
|
|
sub campaigns_fromtemplate { |
981
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
982
|
0
|
|
|
|
|
0
|
my $client_id = delete $request{clientid}; |
983
|
|
|
|
|
|
|
|
984
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ campaigns => $client_id, 'fromtemplate' ], undef, \%request); |
985
|
|
|
|
|
|
|
|
986
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
987
|
|
|
|
|
|
|
} |
988
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
sub campaigns_send { |
990
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
991
|
0
|
|
|
|
|
0
|
my $campaign_id = delete $request{campaignid}; |
992
|
|
|
|
|
|
|
|
993
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ campaigns => $campaign_id, 'send' ], undef, \%request); |
994
|
|
|
|
|
|
|
|
995
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
996
|
|
|
|
|
|
|
} |
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
sub campaigns_unschedule { |
999
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
1000
|
0
|
|
|
|
|
0
|
my $campaign_id = delete $request{campaignid}; |
1001
|
|
|
|
|
|
|
|
1002
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ campaigns => $campaign_id, 'unschedule' ], undef, \%request); |
1003
|
|
|
|
|
|
|
|
1004
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
1005
|
|
|
|
|
|
|
} |
1006
|
|
|
|
|
|
|
|
1007
|
|
|
|
|
|
|
sub campaigns_sendpreview { |
1008
|
0
|
|
|
0
|
1
|
0
|
my ($self, %request) = @_; |
1009
|
0
|
|
|
|
|
0
|
my $campaign_id = delete $request{campaignid}; |
1010
|
|
|
|
|
|
|
|
1011
|
0
|
|
|
|
|
0
|
$self->_rest(POST => [ campaigns => $campaign_id, 'sendpreview' ], undef, \%request); |
1012
|
|
|
|
|
|
|
|
1013
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
1014
|
|
|
|
|
|
|
} |
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
sub campaigns_summary { |
1017
|
0
|
|
|
0
|
1
|
0
|
my ($self, $campaign_id) = @_; |
1018
|
|
|
|
|
|
|
|
1019
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ campaigns => $campaign_id, 'summary' ]); |
1020
|
|
|
|
|
|
|
|
1021
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
1022
|
|
|
|
|
|
|
} |
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
sub campaigns_emailclientusage { |
1025
|
0
|
|
|
0
|
0
|
0
|
my ($self, $campaign_id) = @_; |
1026
|
|
|
|
|
|
|
|
1027
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ campaigns => $campaign_id, 'emailclientusage' ]); |
1028
|
|
|
|
|
|
|
|
1029
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
1030
|
|
|
|
|
|
|
} |
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
sub campaigns_listsandsegments { |
1033
|
0
|
|
|
0
|
1
|
0
|
my ($self, $campaign_id) = @_; |
1034
|
|
|
|
|
|
|
|
1035
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ campaigns => $campaign_id, 'listsandsegments' ]); |
1036
|
|
|
|
|
|
|
|
1037
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
1038
|
|
|
|
|
|
|
} |
1039
|
|
|
|
|
|
|
|
1040
|
|
|
|
|
|
|
sub campaigns_recipients { |
1041
|
0
|
|
|
0
|
1
|
0
|
my ($self, %input) = @_; |
1042
|
0
|
|
|
|
|
0
|
my $campaign_id = delete $input{campaignid}; |
1043
|
|
|
|
|
|
|
|
1044
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
1045
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
1046
|
|
|
|
|
|
|
} |
1047
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
1048
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
1049
|
|
|
|
|
|
|
} |
1050
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
1051
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'date'; |
1052
|
|
|
|
|
|
|
} |
1053
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
1054
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
1055
|
|
|
|
|
|
|
} |
1056
|
|
|
|
|
|
|
|
1057
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ campaigns => $campaign_id, 'recipients' ], \%input); |
1058
|
|
|
|
|
|
|
|
1059
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
1060
|
|
|
|
|
|
|
} |
1061
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
sub campaigns_bounces { |
1063
|
0
|
|
|
0
|
1
|
0
|
my ($self, %input) = @_; |
1064
|
0
|
|
|
|
|
0
|
my $campaign_id = delete $input{campaignid}; |
1065
|
|
|
|
|
|
|
|
1066
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
1067
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
1068
|
|
|
|
|
|
|
} |
1069
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
1070
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
1071
|
|
|
|
|
|
|
} |
1072
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
1073
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'date'; |
1074
|
|
|
|
|
|
|
} |
1075
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
1076
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
1077
|
|
|
|
|
|
|
} |
1078
|
|
|
|
|
|
|
|
1079
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ campaigns => $campaign_id, 'bounces' ], \%input); |
1080
|
|
|
|
|
|
|
|
1081
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
1082
|
|
|
|
|
|
|
} |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
sub campaigns_opens { |
1085
|
0
|
|
|
0
|
1
|
0
|
my ($self, %input) = @_; |
1086
|
0
|
|
|
|
|
0
|
my $campaign_id = delete $input{campaignid}; |
1087
|
|
|
|
|
|
|
|
1088
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
1089
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
1090
|
|
|
|
|
|
|
} |
1091
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
1092
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
1093
|
|
|
|
|
|
|
} |
1094
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
1095
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'date'; |
1096
|
|
|
|
|
|
|
} |
1097
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
1098
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
1099
|
|
|
|
|
|
|
} |
1100
|
|
|
|
|
|
|
|
1101
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ campaigns => $campaign_id, 'opens' ], \%input); |
1102
|
|
|
|
|
|
|
|
1103
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
1104
|
|
|
|
|
|
|
} |
1105
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
sub campaigns_clicks { |
1107
|
0
|
|
|
0
|
1
|
0
|
my ($self, %input) = @_; |
1108
|
0
|
|
|
|
|
0
|
my $campaign_id = delete $input{campaignid}; |
1109
|
|
|
|
|
|
|
|
1110
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
1111
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
1112
|
|
|
|
|
|
|
} |
1113
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
1114
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
1115
|
|
|
|
|
|
|
} |
1116
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
1117
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'date'; |
1118
|
|
|
|
|
|
|
} |
1119
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
1120
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
1121
|
|
|
|
|
|
|
} |
1122
|
|
|
|
|
|
|
|
1123
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ campaigns => $campaign_id, 'clicks' ], \%input); |
1124
|
|
|
|
|
|
|
|
1125
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
1126
|
|
|
|
|
|
|
} |
1127
|
|
|
|
|
|
|
|
1128
|
|
|
|
|
|
|
sub campaigns_unsubscribes { |
1129
|
0
|
|
|
0
|
1
|
0
|
my ($self, %input) = @_; |
1130
|
0
|
|
|
|
|
0
|
my $campaign_id = delete $input{campaignid}; |
1131
|
|
|
|
|
|
|
|
1132
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
1133
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
1134
|
|
|
|
|
|
|
} |
1135
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
1136
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
1137
|
|
|
|
|
|
|
} |
1138
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
1139
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'date'; |
1140
|
|
|
|
|
|
|
} |
1141
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
1142
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
1143
|
|
|
|
|
|
|
} |
1144
|
|
|
|
|
|
|
|
1145
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ campaigns => $campaign_id, 'unsubscribes' ], \%input); |
1146
|
|
|
|
|
|
|
|
1147
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
1148
|
|
|
|
|
|
|
} |
1149
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
sub campaigns_spam { |
1151
|
0
|
|
|
0
|
1
|
0
|
my ($self, %input) = @_; |
1152
|
0
|
|
|
|
|
0
|
my $campaign_id = delete $input{campaignid}; |
1153
|
|
|
|
|
|
|
|
1154
|
0
|
0
|
|
|
|
0
|
unless( Params::Util::_POSINT($input{page}) ) { |
1155
|
0
|
|
|
|
|
0
|
$input{page} = 1; |
1156
|
|
|
|
|
|
|
} |
1157
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) { |
|
|
|
0
|
|
|
|
|
1158
|
0
|
|
|
|
|
0
|
$input{pagesize} = 1000; |
1159
|
|
|
|
|
|
|
} |
1160
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) { |
|
|
|
0
|
|
|
|
|
1161
|
0
|
|
|
|
|
0
|
$input{orderfield} = 'date'; |
1162
|
|
|
|
|
|
|
} |
1163
|
0
|
0
|
0
|
|
|
0
|
unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) { |
|
|
|
0
|
|
|
|
|
1164
|
0
|
|
|
|
|
0
|
$input{orderdirection} = 'asc'; |
1165
|
|
|
|
|
|
|
} |
1166
|
|
|
|
|
|
|
|
1167
|
0
|
|
|
|
|
0
|
$self->_rest(GET => [ campaigns => $campaign_id, 'spam' ], \%input); |
1168
|
|
|
|
|
|
|
|
1169
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
1170
|
|
|
|
|
|
|
} |
1171
|
|
|
|
|
|
|
|
1172
|
|
|
|
|
|
|
sub campaigns_delete { |
1173
|
0
|
|
|
0
|
1
|
0
|
my ($self, $campaign_id) = @_; |
1174
|
|
|
|
|
|
|
|
1175
|
0
|
|
|
|
|
0
|
$self->_rest(DELETE => [ campaigns => $campaign_id ]); |
1176
|
|
|
|
|
|
|
|
1177
|
0
|
|
|
|
|
0
|
return $self->_build_results(); |
1178
|
|
|
|
|
|
|
} |
1179
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
sub _build_results { |
1181
|
1
|
|
|
1
|
|
3
|
my ($self, $client) = @_; |
1182
|
1
|
|
33
|
|
|
11
|
$client ||= $self->{client}; |
1183
|
|
|
|
|
|
|
|
1184
|
16
|
|
|
|
|
817
|
my %results = ( |
1185
|
|
|
|
|
|
|
response => $self->decode( $client->responseContent() ), |
1186
|
|
|
|
|
|
|
code => $client->responseCode(), |
1187
|
1
|
|
|
|
|
6
|
headers => +{ map { $_ => scalar $client->responseHeader($_) } $client->responseHeaders() }, |
1188
|
|
|
|
|
|
|
); |
1189
|
|
|
|
|
|
|
|
1190
|
1
|
|
|
|
|
64
|
return \%results; |
1191
|
|
|
|
|
|
|
} |
1192
|
|
|
|
|
|
|
|
1193
|
|
|
|
|
|
|
# The _build_uri method takes two parameters: |
1194
|
|
|
|
|
|
|
# $path is either an array of path components, |
1195
|
|
|
|
|
|
|
# or a string which converts to a 1 element array |
1196
|
|
|
|
|
|
|
# $query is either an array of query_form parameters |
1197
|
|
|
|
|
|
|
# or a hash of same |
1198
|
|
|
|
|
|
|
# A URI object is returned |
1199
|
|
|
|
|
|
|
sub _build_uri { |
1200
|
1
|
|
|
1
|
|
3
|
my ($self, $path, $query) = @_; |
1201
|
|
|
|
|
|
|
|
1202
|
1
|
50
|
|
|
|
7
|
unless (_ARRAY($path)) { |
1203
|
1
|
50
|
|
|
|
5
|
if (_STRING($path)) { |
1204
|
1
|
|
|
|
|
5
|
$path = [ $path ]; |
1205
|
|
|
|
|
|
|
|
1206
|
|
|
|
|
|
|
} else { |
1207
|
0
|
|
|
|
|
0
|
croak "Unable to parse URL recipe"; |
1208
|
|
|
|
|
|
|
} |
1209
|
|
|
|
|
|
|
} |
1210
|
|
|
|
|
|
|
|
1211
|
1
|
|
|
|
|
13
|
my $uri = $self->{base_uri}->clone; |
1212
|
|
|
|
|
|
|
|
1213
|
1
|
|
|
|
|
11
|
@$path = (@{ $self->{base_path} }, @$path); |
|
1
|
|
|
|
|
6
|
|
1214
|
|
|
|
|
|
|
# specify the type as a file-extension to the last path segment |
1215
|
1
|
|
|
|
|
6
|
$path->[-1] .= ".$self->{format}"; |
1216
|
1
|
|
|
|
|
14
|
$uri->path_segments(@$path); |
1217
|
|
|
|
|
|
|
|
1218
|
1
|
50
|
|
|
|
142
|
if (_HASH($query)) { |
|
|
50
|
|
|
|
|
|
1219
|
0
|
|
|
|
|
0
|
$uri->query_form([ map { $_ => $query->{$_} } sort keys %$query ], '&'); |
|
0
|
|
|
|
|
0
|
|
1220
|
|
|
|
|
|
|
|
1221
|
|
|
|
|
|
|
} elsif (_ARRAY($query)) { |
1222
|
0
|
|
|
|
|
0
|
$uri->query_form($query, '&'); |
1223
|
|
|
|
|
|
|
} |
1224
|
|
|
|
|
|
|
|
1225
|
1
|
|
|
|
|
5
|
return $uri; |
1226
|
|
|
|
|
|
|
} |
1227
|
|
|
|
|
|
|
|
1228
|
|
|
|
|
|
|
# The _rest method takes either a list of parameters or a single hashref |
1229
|
|
|
|
|
|
|
# If a list, they are interpreted in order as method, path, query, body, headers |
1230
|
|
|
|
|
|
|
# where method is the HTTP/REST method to use |
1231
|
|
|
|
|
|
|
# path is the path component of the URL to call, appended to the REST API base |
1232
|
|
|
|
|
|
|
# it can also be an array reference used to construct the path |
1233
|
|
|
|
|
|
|
# query is the query component of the URL to call, it can be a hashref |
1234
|
|
|
|
|
|
|
# body is the body of the HTTP request, for PUT/PATCH/POST methods |
1235
|
|
|
|
|
|
|
# it can be a hashref which will be json encoded |
1236
|
|
|
|
|
|
|
# |
1237
|
|
|
|
|
|
|
# If the first parameter to this function is a hashref, the values correspond to |
1238
|
|
|
|
|
|
|
# keys of those names: method, path, query, body, headers |
1239
|
|
|
|
|
|
|
# |
1240
|
|
|
|
|
|
|
# The method and path parameters are required |
1241
|
|
|
|
|
|
|
# |
1242
|
|
|
|
|
|
|
# A call to the REST::Client instance is built and performed, the result |
1243
|
|
|
|
|
|
|
# of which is returned. |
1244
|
|
|
|
|
|
|
sub _rest { |
1245
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
1246
|
1
|
|
|
|
|
2
|
my $params; |
1247
|
1
|
50
|
|
|
|
7
|
if (Params::Util::_HASH($_[0])) { |
1248
|
0
|
|
|
|
|
0
|
$params = shift; |
1249
|
|
|
|
|
|
|
|
1250
|
|
|
|
|
|
|
} else { |
1251
|
1
|
|
|
|
|
3
|
$params = {}; |
1252
|
1
|
|
|
|
|
10
|
@$params{qw(method path query body headers)} = @_; |
1253
|
|
|
|
|
|
|
} |
1254
|
|
|
|
|
|
|
|
1255
|
1
|
|
|
|
|
4
|
my $method = $params->{method}; |
1256
|
1
|
|
|
|
|
7
|
my $uri = $self->_build_uri($params->{path}, $params->{query}); |
1257
|
|
|
|
|
|
|
|
1258
|
1
|
|
|
|
|
11
|
my @args = ($uri->as_string); |
1259
|
1
|
50
|
|
|
|
12
|
if ($method =~ /^(?:PUT|PATCH|POST)$/) { |
1260
|
0
|
0
|
|
|
|
0
|
if (ref $params->{body}) { |
1261
|
0
|
|
|
|
|
0
|
my $body = encode_json $params->{body}; |
1262
|
0
|
|
|
|
|
0
|
push @args, $body; |
1263
|
|
|
|
|
|
|
|
1264
|
|
|
|
|
|
|
} else { |
1265
|
0
|
|
|
|
|
0
|
push @args, $params->{body}; |
1266
|
|
|
|
|
|
|
} |
1267
|
|
|
|
|
|
|
} |
1268
|
|
|
|
|
|
|
|
1269
|
1
|
50
|
|
|
|
9
|
push @args, $params->{headers} if defined $params->{headers}; |
1270
|
|
|
|
|
|
|
|
1271
|
1
|
|
|
|
|
14
|
return $self->{client}->$method(@args); |
1272
|
|
|
|
|
|
|
} |
1273
|
|
|
|
|
|
|
|
1274
|
|
|
|
|
|
|
1; |
1275
|
|
|
|
|
|
|
|
1276
|
|
|
|
|
|
|
__END__ |