| 1 | package Mail::Chimp3; | ||||||||||||
| 2 | |||||||||||||
| 3 | 2 | ▶ | use 5.010001; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 2 | ▶ | use strictures 2; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 2 | ▶ | use namespace::autoclean 0.16; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 2 | ▶ | use Types::Standard qw/ Num Str /; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | with 'Web::API'; | ||||||||||||
| 10 | |||||||||||||
| 11 | # ABSTRACT: An interface to mailchimp.com's RESTful Web API v3 using WEB::API | ||||||||||||
| 12 | |||||||||||||
| 13 | our $VERSION = '0.05'; # VERSION: generated by DZP::OurPkgVersion | ||||||||||||
| 14 | |||||||||||||
| 15 | |||||||||||||
| 16 | has endpoints => ( | ||||||||||||
| 17 | is => 'rw', | ||||||||||||
| 18 | default => sub { | ||||||||||||
| 19 | { | ||||||||||||
| 20 | root => { path => '/' }, | ||||||||||||
| 21 | |||||||||||||
| 22 | # authorized apps | ||||||||||||
| 23 | authorized_apps => { path => 'authorized-apps' }, | ||||||||||||
| 24 | authorized_app => { path => 'authorized-apps/:app_id' }, | ||||||||||||
| 25 | add_authorized_app => { | ||||||||||||
| 26 | method => 'POST', | ||||||||||||
| 27 | path => 'authorized-apps', | ||||||||||||
| 28 | mandatory => [ 'client_id', 'client_secret', ], | ||||||||||||
| 29 | }, | ||||||||||||
| 30 | |||||||||||||
| 31 | # automations | ||||||||||||
| 32 | automations => { path => 'automations' }, | ||||||||||||
| 33 | automation => { path => 'automations/:workflow_id' }, | ||||||||||||
| 34 | pause_automation => { | ||||||||||||
| 35 | method => 'POST', | ||||||||||||
| 36 | path => 'automations/:workflow_id/actions/pause-all-emails', | ||||||||||||
| 37 | }, | ||||||||||||
| 38 | start_automation => { | ||||||||||||
| 39 | method => 'POST', | ||||||||||||
| 40 | path => 'automations/:workflow_id/actions/start-all-emails', | ||||||||||||
| 41 | }, | ||||||||||||
| 42 | |||||||||||||
| 43 | # automation emails | ||||||||||||
| 44 | automation_emails => { path => 'automations/:workflow_id/emails' }, | ||||||||||||
| 45 | automation_email => { path => 'automations/:workflow_id/emails/:workflow_email_id' }, | ||||||||||||
| 46 | pause_automation_email => { | ||||||||||||
| 47 | method => 'POST', | ||||||||||||
| 48 | path => 'automations/:workflow_id/emails/:workflow_email_id/actions/pause', | ||||||||||||
| 49 | }, | ||||||||||||
| 50 | start_automation_email => { | ||||||||||||
| 51 | method => 'POST', | ||||||||||||
| 52 | path => 'automations/:workflow_id/emails/:workflow_email_id/actions/start', | ||||||||||||
| 53 | }, | ||||||||||||
| 54 | add_automation_subscriber => { | ||||||||||||
| 55 | method => 'POST', | ||||||||||||
| 56 | path => 'automations/:workflow_id/emails/:workflow_email_id/queue', | ||||||||||||
| 57 | mandatory => ['email_address'], | ||||||||||||
| 58 | }, | ||||||||||||
| 59 | automation_subscribers => { | ||||||||||||
| 60 | path => 'automations/:workflow_id/emails/:workflow_email_id/queue', | ||||||||||||
| 61 | }, | ||||||||||||
| 62 | automation_subscriber => { | ||||||||||||
| 63 | path => 'automations/:workflow_id/emails/:workflow_email_id/queue/:subscriber_hash', | ||||||||||||
| 64 | }, | ||||||||||||
| 65 | remove_automation_subscriber => { | ||||||||||||
| 66 | method => 'POST', | ||||||||||||
| 67 | path => 'automations/:workflow_id/removed-subscribers', | ||||||||||||
| 68 | mandatory => ['email_address'], | ||||||||||||
| 69 | }, | ||||||||||||
| 70 | removed_automation_subscribers => { path => 'automations/:workflow_id/removed-subscribers' }, | ||||||||||||
| 71 | |||||||||||||
| 72 | # batch | ||||||||||||
| 73 | batches => { path => 'batches' }, | ||||||||||||
| 74 | batch => { path => 'batches/:batch_id' }, | ||||||||||||
| 75 | add_batch => { | ||||||||||||
| 76 | method => 'POST', | ||||||||||||
| 77 | path => 'batches', | ||||||||||||
| 78 | mandatory => ['operations'], | ||||||||||||
| 79 | }, | ||||||||||||
| 80 | delete_batch => { | ||||||||||||
| 81 | method => 'DELETE', | ||||||||||||
| 82 | path => 'batches/:batch_id', | ||||||||||||
| 83 | }, | ||||||||||||
| 84 | |||||||||||||
| 85 | # campaign folders | ||||||||||||
| 86 | campaign_folders => { path => 'campaign-folders' }, | ||||||||||||
| 87 | campaign_folder => { path => 'campaign-folders/:folder_id' }, | ||||||||||||
| 88 | add_campaign_folder => { | ||||||||||||
| 89 | method => 'POST', | ||||||||||||
| 90 | path => 'campaign-folders', | ||||||||||||
| 91 | mandatory => ['name'], | ||||||||||||
| 92 | }, | ||||||||||||
| 93 | update_campaign_folder => { | ||||||||||||
| 94 | method => 'PATCH', | ||||||||||||
| 95 | path => 'campaign-folders/:folder_id', | ||||||||||||
| 96 | mandatory => ['name'], | ||||||||||||
| 97 | }, | ||||||||||||
| 98 | delete_campaign_folder => { | ||||||||||||
| 99 | method => 'DELETE', | ||||||||||||
| 100 | path => 'campaign-folders/:folder_id', | ||||||||||||
| 101 | }, | ||||||||||||
| 102 | |||||||||||||
| 103 | # campaigns | ||||||||||||
| 104 | campaigns => { path => 'campaigns' }, | ||||||||||||
| 105 | campaign => { path => 'campaigns/:campaign_id' }, | ||||||||||||
| 106 | add_campaign => { | ||||||||||||
| 107 | method => 'POST', | ||||||||||||
| 108 | path => 'campaigns', | ||||||||||||
| 109 | mandatory => [ 'type', 'settings' ], | ||||||||||||
| 110 | }, | ||||||||||||
| 111 | update_campaign => { | ||||||||||||
| 112 | method => 'PATCH', | ||||||||||||
| 113 | path => 'campaigns/:campaign_id', | ||||||||||||
| 114 | mandatory => [ 'type', 'settings' ], | ||||||||||||
| 115 | }, | ||||||||||||
| 116 | delete_campaign => { | ||||||||||||
| 117 | method => 'DELETE', | ||||||||||||
| 118 | path => 'campaigns/:campaign_id', | ||||||||||||
| 119 | }, | ||||||||||||
| 120 | cancel_campaign => { | ||||||||||||
| 121 | method => 'POST', | ||||||||||||
| 122 | path => 'campaigns/:campaign_id/actions/cancel-send', | ||||||||||||
| 123 | }, | ||||||||||||
| 124 | pause_campaign => { | ||||||||||||
| 125 | method => 'POST', | ||||||||||||
| 126 | path => 'campaigns/:campaign_id/actions/pause', | ||||||||||||
| 127 | }, | ||||||||||||
| 128 | replicate_campaign => { | ||||||||||||
| 129 | method => 'POST', | ||||||||||||
| 130 | path => 'campaigns/:campaign_id/actions/replicate', | ||||||||||||
| 131 | }, | ||||||||||||
| 132 | resume_campaign => { | ||||||||||||
| 133 | method => 'POST', | ||||||||||||
| 134 | path => 'campaigns/:campaign_id/actions/resume', | ||||||||||||
| 135 | }, | ||||||||||||
| 136 | schedule_campaign => { | ||||||||||||
| 137 | method => 'POST', | ||||||||||||
| 138 | path => 'campaigns/:campaign_id/actions/schedule', | ||||||||||||
| 139 | mandatory => ['schedule_time'], | ||||||||||||
| 140 | }, | ||||||||||||
| 141 | send_campaign => { | ||||||||||||
| 142 | method => 'POST', | ||||||||||||
| 143 | path => 'campaigns/:campaign_id/actions/send', | ||||||||||||
| 144 | }, | ||||||||||||
| 145 | test_campaign => { | ||||||||||||
| 146 | method => 'POST', | ||||||||||||
| 147 | path => 'campaigns/:campaign_id/actions/test', | ||||||||||||
| 148 | mandatory => [ 'test_emails', 'send_type' ], | ||||||||||||
| 149 | }, | ||||||||||||
| 150 | unschedule_campaign => { | ||||||||||||
| 151 | method => 'POST', | ||||||||||||
| 152 | path => 'campaigns/:campaign_id/actions/unschedule', | ||||||||||||
| 153 | }, | ||||||||||||
| 154 | campaign_content => { path => 'campaigns/:campaign_id/content' }, | ||||||||||||
| 155 | set_campaign_content => { | ||||||||||||
| 156 | method => 'PUT', | ||||||||||||
| 157 | path => 'campaigns/:campaign_id/content', | ||||||||||||
| 158 | }, | ||||||||||||
| 159 | campaign_feedbacks => { path => 'campaigns/:campaign_id/feedback' }, | ||||||||||||
| 160 | campaign_feedback => { path => 'campaigns/:campaign_id/feedback/:feedback_id' }, | ||||||||||||
| 161 | add_campaign_feedback => { | ||||||||||||
| 162 | method => 'POST', | ||||||||||||
| 163 | path => 'campaigns/:campaign_id/feedback', | ||||||||||||
| 164 | mandatory => ['message'], | ||||||||||||
| 165 | }, | ||||||||||||
| 166 | update_campaign_feedback => { | ||||||||||||
| 167 | method => 'PATCH', | ||||||||||||
| 168 | path => 'campaigns/:campaign_id/feedback/:feedback_id', | ||||||||||||
| 169 | mandatory => ['message'], | ||||||||||||
| 170 | }, | ||||||||||||
| 171 | delete_campaign_feedback => { | ||||||||||||
| 172 | method => 'DELETE', | ||||||||||||
| 173 | path => 'campaigns/:campaign_id/feedback/:feedback_id', | ||||||||||||
| 174 | }, | ||||||||||||
| 175 | campaign_send_checklist => { path => 'campaigns/:campaign_id/send-checklist' }, | ||||||||||||
| 176 | |||||||||||||
| 177 | # conversations | ||||||||||||
| 178 | conversations => { path => 'conversations' }, | ||||||||||||
| 179 | conversation => { path => 'conversations/:conversation_id' }, | ||||||||||||
| 180 | add_conversation_message => { | ||||||||||||
| 181 | method => 'POST', | ||||||||||||
| 182 | path => 'conversations/:conversation_id/messages', | ||||||||||||
| 183 | mandatory => [ 'from_email', 'read' ], | ||||||||||||
| 184 | }, | ||||||||||||
| 185 | conversation_messages => { path => 'conversation/:conversation_id/messages' }, | ||||||||||||
| 186 | conversation_message => { path => 'conversation/:conversation_id/messages/:message_id' }, | ||||||||||||
| 187 | |||||||||||||
| 188 | # ecommerce stores | ||||||||||||
| 189 | stores => { path => 'ecommerce/stores' }, | ||||||||||||
| 190 | store => { path => 'ecommerce/stores/:store_id' }, | ||||||||||||
| 191 | add_store => { | ||||||||||||
| 192 | method => 'POST', | ||||||||||||
| 193 | path => 'ecommerce/stores', | ||||||||||||
| 194 | mandatory => [ 'id', 'list_id', 'name', 'currency_code', ], | ||||||||||||
| 195 | }, | ||||||||||||
| 196 | update_store => { | ||||||||||||
| 197 | method => 'PATCH', | ||||||||||||
| 198 | path => 'ecommerce/stores/:store_id', | ||||||||||||
| 199 | }, | ||||||||||||
| 200 | delete_store => { | ||||||||||||
| 201 | method => 'DELETE', | ||||||||||||
| 202 | path => 'ecommerce/stores/:store_id', | ||||||||||||
| 203 | }, | ||||||||||||
| 204 | |||||||||||||
| 205 | # ecommerce carts | ||||||||||||
| 206 | carts => { path => 'ecommerce/stores/:store_id/carts' }, | ||||||||||||
| 207 | cart => { path => 'ecommerce/stores/:store_id/carts/:cart_id' }, | ||||||||||||
| 208 | add_cart => { | ||||||||||||
| 209 | method => 'POST', | ||||||||||||
| 210 | path => 'ecommerce/stores/:store_id/carts', | ||||||||||||
| 211 | mandatory => ['customer'], | ||||||||||||
| 212 | }, | ||||||||||||
| 213 | update_cart => { | ||||||||||||
| 214 | method => 'PATCH', | ||||||||||||
| 215 | path => 'ecommerce/stores/:store_id/carts/:cart_id', | ||||||||||||
| 216 | }, | ||||||||||||
| 217 | delete_cart => { | ||||||||||||
| 218 | method => 'DELETE', | ||||||||||||
| 219 | path => 'ecommerce/stores/:store_id/carts/:cart_id', | ||||||||||||
| 220 | }, | ||||||||||||
| 221 | |||||||||||||
| 222 | # ecommerce cart lines | ||||||||||||
| 223 | cart_lines => { path => 'ecommerce/stores/:store_id/carts/:cart_id/lines' }, | ||||||||||||
| 224 | cart_line => { path => 'ecommerce/stores/:store_id/carts/:cart_id/lines/:line_id' }, | ||||||||||||
| 225 | add_cart_line => { | ||||||||||||
| 226 | method => 'POST', | ||||||||||||
| 227 | path => 'ecommerce/stores/:store_id/carts/:cart_id/lines', | ||||||||||||
| 228 | mandatory => [ | ||||||||||||
| 229 | qw/ | ||||||||||||
| 230 | id | ||||||||||||
| 231 | product_id | ||||||||||||
| 232 | product_variant_id | ||||||||||||
| 233 | quantity | ||||||||||||
| 234 | price | ||||||||||||
| 235 | / | ||||||||||||
| 236 | ], | ||||||||||||
| 237 | }, | ||||||||||||
| 238 | update_cart_line => { | ||||||||||||
| 239 | method => 'PATCH', | ||||||||||||
| 240 | path => 'ecommerce/stores/:store_id/carts/:cart_id/lines/:line_id', | ||||||||||||
| 241 | }, | ||||||||||||
| 242 | delete_cart_line => { | ||||||||||||
| 243 | method => 'DELETE', | ||||||||||||
| 244 | path => 'ecommerce/stores/:store_id/carts/:cart_id/lines/:line_id', | ||||||||||||
| 245 | }, | ||||||||||||
| 246 | |||||||||||||
| 247 | # ecommerce customers | ||||||||||||
| 248 | customers => { path => 'ecommerce/stores/:store_id/customers' }, | ||||||||||||
| 249 | customer => { path => 'ecommerce/stores/:store_id/customers/:customer_id' }, | ||||||||||||
| 250 | add_customer => { | ||||||||||||
| 251 | method => 'POST', | ||||||||||||
| 252 | path => 'ecommerce/stores/:store_id/customers', | ||||||||||||
| 253 | mandatory => [ | ||||||||||||
| 254 | qw/ | ||||||||||||
| 255 | id | ||||||||||||
| 256 | email_address | ||||||||||||
| 257 | opt_in_status | ||||||||||||
| 258 | / | ||||||||||||
| 259 | ], | ||||||||||||
| 260 | }, | ||||||||||||
| 261 | update_customer => { | ||||||||||||
| 262 | method => 'PATCH', | ||||||||||||
| 263 | path => 'ecommerce/stores/:store_id/customers/:customer_id', | ||||||||||||
| 264 | }, | ||||||||||||
| 265 | upsert_customer => { | ||||||||||||
| 266 | method => 'PUT', | ||||||||||||
| 267 | path => 'ecommerce/stores/:store_id/customers/:customer_id', | ||||||||||||
| 268 | mandatory => [ | ||||||||||||
| 269 | qw/ | ||||||||||||
| 270 | id | ||||||||||||
| 271 | email_address | ||||||||||||
| 272 | opt_in_status | ||||||||||||
| 273 | / | ||||||||||||
| 274 | ], | ||||||||||||
| 275 | }, | ||||||||||||
| 276 | delete_customer => { | ||||||||||||
| 277 | method => 'DELETE', | ||||||||||||
| 278 | path => 'ecommerce/stores/:store_id/customers/:customer_id', | ||||||||||||
| 279 | }, | ||||||||||||
| 280 | |||||||||||||
| 281 | # ecommerce orders | ||||||||||||
| 282 | orders => { path => 'ecommerce/stores/:store_id/orders' }, | ||||||||||||
| 283 | order => { path => 'ecommerce/stores/:store_id/orders/:order_id' }, | ||||||||||||
| 284 | add_order => { | ||||||||||||
| 285 | method => 'POST', | ||||||||||||
| 286 | path => 'ecommerce/stores/:store_id/orders', | ||||||||||||
| 287 | mandatory => [ | ||||||||||||
| 288 | qw/ | ||||||||||||
| 289 | id | ||||||||||||
| 290 | customer | ||||||||||||
| 291 | currency_code | ||||||||||||
| 292 | order_total | ||||||||||||
| 293 | lines | ||||||||||||
| 294 | / | ||||||||||||
| 295 | ], | ||||||||||||
| 296 | }, | ||||||||||||
| 297 | update_order => { | ||||||||||||
| 298 | method => 'PATCH', | ||||||||||||
| 299 | path => 'ecommerce/stores/:store_id/orders/:order_id', | ||||||||||||
| 300 | }, | ||||||||||||
| 301 | delete_order => { | ||||||||||||
| 302 | method => 'DELETE', | ||||||||||||
| 303 | path => 'ecommerce/stores/:store_id/orders/:order_id', | ||||||||||||
| 304 | }, | ||||||||||||
| 305 | |||||||||||||
| 306 | # ecommerce order lines | ||||||||||||
| 307 | order_lines => { path => 'ecommerce/stores/:store_id/orders/:order_id/lines' }, | ||||||||||||
| 308 | order_line => { path => 'ecommerce/stores/:store_id/orders/:order_id/lines/:line_id' }, | ||||||||||||
| 309 | add_order_line => { | ||||||||||||
| 310 | method => 'POST', | ||||||||||||
| 311 | path => 'ecommerce/stores/:store_id/orders/:order_id/lines', | ||||||||||||
| 312 | mandatory => [ | ||||||||||||
| 313 | qw/ | ||||||||||||
| 314 | id | ||||||||||||
| 315 | product_id | ||||||||||||
| 316 | product_variant_id | ||||||||||||
| 317 | quantity | ||||||||||||
| 318 | price | ||||||||||||
| 319 | / | ||||||||||||
| 320 | ], | ||||||||||||
| 321 | }, | ||||||||||||
| 322 | update_order_line => { | ||||||||||||
| 323 | method => 'PATCH', | ||||||||||||
| 324 | path => 'ecommerce/stores/:store_id/orders/:order_id/lines/:line_id', | ||||||||||||
| 325 | }, | ||||||||||||
| 326 | delete_order_line => { | ||||||||||||
| 327 | method => 'DELETE', | ||||||||||||
| 328 | path => 'ecommerce/stores/:store_id/orders/:order_id/lines/:line_id', | ||||||||||||
| 329 | }, | ||||||||||||
| 330 | |||||||||||||
| 331 | # ecommerce products | ||||||||||||
| 332 | products => { path => 'ecommerce/stores/:store_id/products' }, | ||||||||||||
| 333 | product => { path => 'ecommerce/stores/:store_id/products/:product_id' }, | ||||||||||||
| 334 | add_product => { | ||||||||||||
| 335 | method => 'POST', | ||||||||||||
| 336 | path => 'ecommerce/stores/:store_id/products', | ||||||||||||
| 337 | mandatory => [ 'id', 'title', 'variants', ], | ||||||||||||
| 338 | }, | ||||||||||||
| 339 | delete_product => { | ||||||||||||
| 340 | method => 'DELETE', | ||||||||||||
| 341 | path => 'ecommerce/stores/:store_id/products/:product_id', | ||||||||||||
| 342 | }, | ||||||||||||
| 343 | |||||||||||||
| 344 | # ecommerce product variants | ||||||||||||
| 345 | variants => { path => 'ecommerce/stores/:store_id/products/:product_id/variants' }, | ||||||||||||
| 346 | variant => { path => 'ecommerce/stores/:store_id/products/:product_id/variants/:variant_id' }, | ||||||||||||
| 347 | add_variant => { | ||||||||||||
| 348 | method => 'POST', | ||||||||||||
| 349 | path => 'ecommerce/stores/:store_id/products/:product_id/variants', | ||||||||||||
| 350 | mandatory => [ 'id', 'title', ], | ||||||||||||
| 351 | }, | ||||||||||||
| 352 | update_variant => { | ||||||||||||
| 353 | method => 'PATCH', | ||||||||||||
| 354 | path => 'ecommerce/stores/:store_id/products/:product_id/variants/:variant_id', | ||||||||||||
| 355 | }, | ||||||||||||
| 356 | upsert_variant => { | ||||||||||||
| 357 | method => 'PUT', | ||||||||||||
| 358 | path => 'ecommerce/stores/:store_id/products/:product_id/variants/:variant_id', | ||||||||||||
| 359 | mandatory => [ 'id', 'title', ], | ||||||||||||
| 360 | }, | ||||||||||||
| 361 | delete_variant => { | ||||||||||||
| 362 | method => 'DELETE', | ||||||||||||
| 363 | path => 'ecommerce/stores/:store_id/products/:product_id/variants/:variant_id', | ||||||||||||
| 364 | }, | ||||||||||||
| 365 | |||||||||||||
| 366 | # file manager files | ||||||||||||
| 367 | file_manager_files => { path => 'file-manager/files' }, | ||||||||||||
| 368 | file_manager_file => { path => 'file-manager/files/:file_id' }, | ||||||||||||
| 369 | add_file_manager_file => { | ||||||||||||
| 370 | method => 'POST', | ||||||||||||
| 371 | path => 'file-manager/files', | ||||||||||||
| 372 | mandatory => [ 'name', 'file_data' ], | ||||||||||||
| 373 | }, | ||||||||||||
| 374 | update_file_manager_file => { | ||||||||||||
| 375 | method => 'PATCH', | ||||||||||||
| 376 | path => 'file-manager/files/:file_id', | ||||||||||||
| 377 | mandatory => [ 'name', 'file_data' ], | ||||||||||||
| 378 | }, | ||||||||||||
| 379 | delete_file_manager_file => { | ||||||||||||
| 380 | method => 'DELETE', | ||||||||||||
| 381 | path => 'file-manager/files/:file_id', | ||||||||||||
| 382 | }, | ||||||||||||
| 383 | |||||||||||||
| 384 | # file manager folders | ||||||||||||
| 385 | file_manager_folders => { path => 'file-manager/folders' }, | ||||||||||||
| 386 | file_manager_folder => { path => 'file-manager/folders/:folder_id' }, | ||||||||||||
| 387 | add_file_manager_folder => { | ||||||||||||
| 388 | method => 'POST', | ||||||||||||
| 389 | path => 'file-manager/folders', | ||||||||||||
| 390 | mandatory => ['name'], | ||||||||||||
| 391 | }, | ||||||||||||
| 392 | update_file_manager_folder => { | ||||||||||||
| 393 | method => 'PATCH', | ||||||||||||
| 394 | path => 'file-manager/folders/:folder_id', | ||||||||||||
| 395 | mandatory => ['name'], | ||||||||||||
| 396 | }, | ||||||||||||
| 397 | delete_file_manager_folder => { | ||||||||||||
| 398 | method => 'DELETE', | ||||||||||||
| 399 | path => 'file-manager/folders/:folder_id', | ||||||||||||
| 400 | }, | ||||||||||||
| 401 | |||||||||||||
| 402 | # lists | ||||||||||||
| 403 | lists => { path => 'lists' }, | ||||||||||||
| 404 | list => { path => 'lists/:list_id' }, | ||||||||||||
| 405 | add_list => { | ||||||||||||
| 406 | method => 'POST', | ||||||||||||
| 407 | path => 'lists', | ||||||||||||
| 408 | mandatory => [ | ||||||||||||
| 409 | qw/ | ||||||||||||
| 410 | name | ||||||||||||
| 411 | contact | ||||||||||||
| 412 | permission_reminder | ||||||||||||
| 413 | campaign_defaults | ||||||||||||
| 414 | email_type_option | ||||||||||||
| 415 | / | ||||||||||||
| 416 | ], | ||||||||||||
| 417 | }, | ||||||||||||
| 418 | update_list => { | ||||||||||||
| 419 | method => 'PATCH', | ||||||||||||
| 420 | path => 'lists/:list_id', | ||||||||||||
| 421 | mandatory => [ | ||||||||||||
| 422 | qw/ | ||||||||||||
| 423 | name | ||||||||||||
| 424 | contact | ||||||||||||
| 425 | permission_reminder | ||||||||||||
| 426 | campaign_defaults | ||||||||||||
| 427 | email_type_option | ||||||||||||
| 428 | / | ||||||||||||
| 429 | ], | ||||||||||||
| 430 | }, | ||||||||||||
| 431 | delete_list => { | ||||||||||||
| 432 | method => 'DELETE', | ||||||||||||
| 433 | path => 'lists/:list_id', | ||||||||||||
| 434 | }, | ||||||||||||
| 435 | batch_list => { | ||||||||||||
| 436 | method => 'POST', | ||||||||||||
| 437 | path => 'lists/:list_id', | ||||||||||||
| 438 | mandatory => ['members'], | ||||||||||||
| 439 | }, | ||||||||||||
| 440 | abuse_reports => { path => 'lists/:list_id/abuse-reports' }, | ||||||||||||
| 441 | abuse_report => { path => 'lists/:list_id/abuse-reports/:report_id' }, | ||||||||||||
| 442 | list_activity => { path => 'lists/:list_id/activity' }, | ||||||||||||
| 443 | list_clients => { path => 'lists/:list_id/clients' }, | ||||||||||||
| 444 | growth_history => { path => 'lists/:list_id/growth-history' }, | ||||||||||||
| 445 | growth_history_month => { path => 'lists/:list_id/growth-history/:month' }, | ||||||||||||
| 446 | |||||||||||||
| 447 | # list interests | ||||||||||||
| 448 | interest_categories => { path => 'lists/:list_id/interest-categories' }, | ||||||||||||
| 449 | interest_category => { path => 'lists/:list_id/interest-categories/:interest_category_id' }, | ||||||||||||
| 450 | add_interest_category => { | ||||||||||||
| 451 | method => 'POST', | ||||||||||||
| 452 | path => 'lists/:list_id/interest-categories', | ||||||||||||
| 453 | mandatory => [ 'title', 'type' ], | ||||||||||||
| 454 | }, | ||||||||||||
| 455 | update_interest_category => { | ||||||||||||
| 456 | method => 'PATCH', | ||||||||||||
| 457 | path => 'lists/:list_id/interest-categories/:interest_category_id', | ||||||||||||
| 458 | mandatory => [ 'title', 'type' ], | ||||||||||||
| 459 | }, | ||||||||||||
| 460 | delete_interest_category => { | ||||||||||||
| 461 | method => 'DELETE', | ||||||||||||
| 462 | path => 'lists/:list_id/interest-categories/:interest_category_id', | ||||||||||||
| 463 | }, | ||||||||||||
| 464 | interests => { path => 'lists/:list_id/interest-categories/:interest_category_id/interests' }, | ||||||||||||
| 465 | interest => { path => 'lists/:list_id/interest-categories/:interest_category_id/interests/:interest_id' }, | ||||||||||||
| 466 | add_interest => { | ||||||||||||
| 467 | method => 'POST', | ||||||||||||
| 468 | path => 'lists/:list_id/interest-categories/:interest_category_id/interests', | ||||||||||||
| 469 | mandatory => ['name'], | ||||||||||||
| 470 | }, | ||||||||||||
| 471 | update_interest => { | ||||||||||||
| 472 | method => 'PATCH', | ||||||||||||
| 473 | path => 'lists/:list_id/interest-categories/:interest_category_id/interests/:interest_id', | ||||||||||||
| 474 | mandatory => ['name'], | ||||||||||||
| 475 | }, | ||||||||||||
| 476 | delete_interest => { | ||||||||||||
| 477 | method => 'DELETE', | ||||||||||||
| 478 | path => 'lists/:list_id/interest-categories/:interest_category_id/interests/:interest_id', | ||||||||||||
| 479 | }, | ||||||||||||
| 480 | |||||||||||||
| 481 | # list members | ||||||||||||
| 482 | members => { path => 'lists/:list_id/members' }, | ||||||||||||
| 483 | member => { path => 'lists/:list_id/members/:subscriber_hash' }, | ||||||||||||
| 484 | add_member => { | ||||||||||||
| 485 | method => 'POST', | ||||||||||||
| 486 | path => 'lists/:list_id/members', | ||||||||||||
| 487 | mandatory => [ 'status', 'email_address', ], | ||||||||||||
| 488 | }, | ||||||||||||
| 489 | update_member => { | ||||||||||||
| 490 | method => 'PATCH', | ||||||||||||
| 491 | path => 'lists/:list_id/members/:subscriber_hash', | ||||||||||||
| 492 | }, | ||||||||||||
| 493 | upsert_member => { | ||||||||||||
| 494 | method => 'PUT', | ||||||||||||
| 495 | path => 'lists/:list_id/members/:subscriber_hash', | ||||||||||||
| 496 | mandatory => [ | ||||||||||||
| 497 | qw/ | ||||||||||||
| 498 | email_address | ||||||||||||
| 499 | status_if_new | ||||||||||||
| 500 | / | ||||||||||||
| 501 | ], | ||||||||||||
| 502 | }, | ||||||||||||
| 503 | delete_member => { | ||||||||||||
| 504 | method => 'DELETE', | ||||||||||||
| 505 | path => 'lists/:list_id/members/:subscriber_hash', | ||||||||||||
| 506 | }, | ||||||||||||
| 507 | member_activity => { path => 'lists/:list_id/members/:subscriber_hash/activity' }, | ||||||||||||
| 508 | member_goals => { path => 'lists/:list_id/members/:subscriber_hash/goals' }, | ||||||||||||
| 509 | |||||||||||||
| 510 | # list member notes | ||||||||||||
| 511 | member_notes => { path => 'lists/:list_id/members/:subscriber_hash/notes' }, | ||||||||||||
| 512 | member_note => { path => 'lists/:list_id/members/:subscriber_hash/notes/:note_id' }, | ||||||||||||
| 513 | add_member_note => { | ||||||||||||
| 514 | method => 'POST', | ||||||||||||
| 515 | path => 'lists/:list_id/members/:subscriber_hash/notes', | ||||||||||||
| 516 | mandatory => ['note'], | ||||||||||||
| 517 | }, | ||||||||||||
| 518 | update_member_note => { | ||||||||||||
| 519 | method => 'POST', | ||||||||||||
| 520 | path => 'lists/:list_id/members/:subscriber_hash/notes/:note_id', | ||||||||||||
| 521 | mandatory => ['note'], | ||||||||||||
| 522 | }, | ||||||||||||
| 523 | delete_member_note => { | ||||||||||||
| 524 | method => 'DELETE', | ||||||||||||
| 525 | path => 'lists/:list_id/members/:subscriber_hash/notes/:note_id', | ||||||||||||
| 526 | }, | ||||||||||||
| 527 | |||||||||||||
| 528 | # list merge fields | ||||||||||||
| 529 | merge_fields => { path => 'lists/:list_id/merge-fields' }, | ||||||||||||
| 530 | merge_field => { path => 'lists/:list_id/merge-fields/:merge_id' }, | ||||||||||||
| 531 | add_merge_field => { | ||||||||||||
| 532 | method => 'POST', | ||||||||||||
| 533 | path => 'lists/:list_id/merge-fields', | ||||||||||||
| 534 | mandatory => [ 'name', 'type', ], | ||||||||||||
| 535 | }, | ||||||||||||
| 536 | update_merge_field => { | ||||||||||||
| 537 | method => 'PATCH', | ||||||||||||
| 538 | path => 'lists/:list_id/merge-fields/:merge_id', | ||||||||||||
| 539 | }, | ||||||||||||
| 540 | delete_merge_field => { | ||||||||||||
| 541 | method => 'DELETE', | ||||||||||||
| 542 | path => 'lists/:list_id/merge-fields/:merge_id', | ||||||||||||
| 543 | }, | ||||||||||||
| 544 | |||||||||||||
| 545 | # list segments | ||||||||||||
| 546 | segments => { path => 'lists/:list_id/segments' }, | ||||||||||||
| 547 | segment => { path => 'lists/:list_id/segments/:segment_id' }, | ||||||||||||
| 548 | add_segment => { | ||||||||||||
| 549 | method => 'POST', | ||||||||||||
| 550 | path => 'lists/:list_id/segments', | ||||||||||||
| 551 | mandatory => ['name'], | ||||||||||||
| 552 | }, | ||||||||||||
| 553 | update_segment => { | ||||||||||||
| 554 | method => 'PATCH', | ||||||||||||
| 555 | path => 'lists/:list_id/segments/:segment_id', | ||||||||||||
| 556 | }, | ||||||||||||
| 557 | delete_segment => { | ||||||||||||
| 558 | method => 'DELETE', | ||||||||||||
| 559 | path => 'lists/:list_id/segments/:segment_id', | ||||||||||||
| 560 | }, | ||||||||||||
| 561 | segment_members => { path => 'lists/:list_id/segments/:segment_id/members' }, | ||||||||||||
| 562 | add_segment_member => { | ||||||||||||
| 563 | method => 'POST', | ||||||||||||
| 564 | path => 'lists/:list_id/segments/:segment_id/members' | ||||||||||||
| 565 | }, | ||||||||||||
| 566 | delete_segment_member => { | ||||||||||||
| 567 | method => 'DELETE', | ||||||||||||
| 568 | path => 'lists/:list_id/segments/:segment_id/members/:subscriber_hash' | ||||||||||||
| 569 | }, | ||||||||||||
| 570 | batch_segment => { | ||||||||||||
| 571 | method => 'POST', | ||||||||||||
| 572 | path => 'lists/:list_id/segments/:segment_id', | ||||||||||||
| 573 | }, | ||||||||||||
| 574 | |||||||||||||
| 575 | # list other | ||||||||||||
| 576 | twitter_cards => { path => 'lists/:list_id/twitter-lead-gen-cards' }, | ||||||||||||
| 577 | twitter_card => { path => 'lists/:list_id/twitter-lead-gen-cards/:twitter_card_id' }, | ||||||||||||
| 578 | add_twitter_card => { | ||||||||||||
| 579 | method => 'POST', | ||||||||||||
| 580 | path => 'lists/:list_id/twitter-lead-gen-cards', | ||||||||||||
| 581 | mandatory => [ | ||||||||||||
| 582 | qw/ | ||||||||||||
| 583 | name | ||||||||||||
| 584 | title | ||||||||||||
| 585 | cta_text | ||||||||||||
| 586 | privacy_policy_url | ||||||||||||
| 587 | image_url | ||||||||||||
| 588 | twitter_account_id | ||||||||||||
| 589 | / | ||||||||||||
| 590 | ], | ||||||||||||
| 591 | }, | ||||||||||||
| 592 | webhooks => { path => 'lists/:list_id/webhooks' }, | ||||||||||||
| 593 | webhook => { path => 'lists/:list_id/webhooks/:webhook_id' }, | ||||||||||||
| 594 | add_webhook => { | ||||||||||||
| 595 | method => 'POST', | ||||||||||||
| 596 | path => 'lists/:list_id/webhooks' | ||||||||||||
| 597 | }, | ||||||||||||
| 598 | delete_webhook => { | ||||||||||||
| 599 | method => 'DELETE', | ||||||||||||
| 600 | path => 'lists/:list_id/webhooks/:webhook_id' | ||||||||||||
| 601 | }, | ||||||||||||
| 602 | |||||||||||||
| 603 | # reports | ||||||||||||
| 604 | reports => { path => 'reports' }, | ||||||||||||
| 605 | report => { path => 'reports/:campaign_id' }, | ||||||||||||
| 606 | abuse_reports => { path => 'reports/:campaign_id/abuse-reports' }, | ||||||||||||
| 607 | abuse_report => { path => 'reports/:campaign_id/abuse-reports/:report_id' }, | ||||||||||||
| 608 | advice => { path => 'reports/:campaign_id/advice' }, | ||||||||||||
| 609 | click_details => { path => 'reports/:campaign_id/click-details' }, | ||||||||||||
| 610 | click_detail => { path => 'reports/:campaign_id/click-details/:link_id' }, | ||||||||||||
| 611 | click_details_members => { path => 'reports/:campaign_id/click-details/:link_id/members' }, | ||||||||||||
| 612 | click_details_member => { path => 'reports/:campaign_id/click-details/:link_id/members/:subscriber_hash' }, | ||||||||||||
| 613 | domain_performance => { path => 'reports/:campaign_id/domain-performance' }, | ||||||||||||
| 614 | eepurl => { path => 'reports/:campaign_id/eepurl' }, | ||||||||||||
| 615 | email_activity => { path => 'reports/:campaign_id/email-activity' }, | ||||||||||||
| 616 | member_email_activity => { path => 'reports/:campaign_id/email-activity/:subscriber_hash' }, | ||||||||||||
| 617 | locations => { path => 'reports/:campaign_id/locations' }, | ||||||||||||
| 618 | sent_to => { path => 'reports/:campaign_id/sent-to' }, | ||||||||||||
| 619 | member_sent_to => { path => 'reports/:campaign_id/sent-to/:subscriber_hash' }, | ||||||||||||
| 620 | sub_reports => { path => 'reports/:campaign_id/sub-reports' }, | ||||||||||||
| 621 | unsubscribed => { path => 'reports/:campaign_id/unsubscribed' }, | ||||||||||||
| 622 | member_unsubscribed => { path => 'reports/:campaign_id/unsubscribed/:subscriber_hash' }, | ||||||||||||
| 623 | |||||||||||||
| 624 | # template folders | ||||||||||||
| 625 | template_folders => { path => 'template-folders' }, | ||||||||||||
| 626 | template_folder => { path => 'template-folders/:folder_id' }, | ||||||||||||
| 627 | add_template_folder => { | ||||||||||||
| 628 | method => 'POST', | ||||||||||||
| 629 | path => 'template-folders', | ||||||||||||
| 630 | mandatory => ['name'], | ||||||||||||
| 631 | }, | ||||||||||||
| 632 | update_template_folder => { | ||||||||||||
| 633 | method => 'PATCH', | ||||||||||||
| 634 | path => 'template-folders/:folder_id', | ||||||||||||
| 635 | mandatory => ['name'], | ||||||||||||
| 636 | }, | ||||||||||||
| 637 | delete_template_folder => { | ||||||||||||
| 638 | method => 'DELETE', | ||||||||||||
| 639 | path => 'template-folders/:folder_id', | ||||||||||||
| 640 | }, | ||||||||||||
| 641 | |||||||||||||
| 642 | # templates | ||||||||||||
| 643 | templates => { path => 'templates' }, | ||||||||||||
| 644 | template => { path => 'templates/:template_id' }, | ||||||||||||
| 645 | add_template => { | ||||||||||||
| 646 | method => 'POST', | ||||||||||||
| 647 | path => 'templates', | ||||||||||||
| 648 | mandatory => [ 'name', 'html' ], | ||||||||||||
| 649 | }, | ||||||||||||
| 650 | update_template => { | ||||||||||||
| 651 | method => 'PATCH', | ||||||||||||
| 652 | path => 'templates/:template_id', | ||||||||||||
| 653 | mandatory => [ 'name', 'html' ], | ||||||||||||
| 654 | }, | ||||||||||||
| 655 | delete_template => { | ||||||||||||
| 656 | method => 'DELETE', | ||||||||||||
| 657 | path => 'templates/:template_id', | ||||||||||||
| 658 | }, | ||||||||||||
| 659 | template_default_content => { path => 'templates/:template_id/default-content' }, | ||||||||||||
| 660 | }; | ||||||||||||
| 661 | }, | ||||||||||||
| 662 | ); | ||||||||||||
| 663 | |||||||||||||
| 664 | has api_version => ( | ||||||||||||
| 665 | is => 'ro', | ||||||||||||
| 666 | isa => Num, | ||||||||||||
| 667 | default => sub { '3.0' }, | ||||||||||||
| 668 | ); | ||||||||||||
| 669 | |||||||||||||
| 670 | has datacenter => ( | ||||||||||||
| 671 | is => 'lazy', | ||||||||||||
| 672 | isa => Str, | ||||||||||||
| 673 | default => sub { | ||||||||||||
| 674 | my $self = shift; | ||||||||||||
| 675 | if ($self->api_key) { | ||||||||||||
| 676 | my ($dc) = ( $self->api_key =~ /\-(\w+)$/ ); | ||||||||||||
| 677 | return $dc; | ||||||||||||
| 678 | } | ||||||||||||
| 679 | else { | ||||||||||||
| 680 | return 'us1'; | ||||||||||||
| 681 | } | ||||||||||||
| 682 | }, | ||||||||||||
| 683 | ); | ||||||||||||
| 684 | |||||||||||||
| 685 | has '+decoder' => ( | ||||||||||||
| 686 | builder => 1, | ||||||||||||
| 687 | ); | ||||||||||||
| 688 | |||||||||||||
| 689 | |||||||||||||
| 690 | sub _build_decoder { | ||||||||||||
| 691 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
_build_decoder: not called CC=1 SCAR=6.9
| |||||||||||||
| 692 | return sub { | ||||||||||||
| 693 | 0 | ▶ | my ($content, $content_type) = @_; | ||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||
| 694 | 0 | my $data = {}; | |||||||||||
| 695 | 0 | ▶ | return $data unless $content; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 696 | 0 | for ($content_type) { | |||||||||||
| 697 | 0 | ▶ | /plain/ and do { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 698 | 0 | chomp $content; | |||||||||||
| 699 | 0 | $data = { text => $content }; | |||||||||||
| 700 | }; | ||||||||||||
| 701 | 0 | ▶ | /urlencoded/ and do { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 702 | 0 | for (split /&/, $content) { | |||||||||||
| 703 | 0 | my ($key, $value) = split /=/; | |||||||||||
| 704 | 0 | $data->{ uri_unescape($key) } = uri_unescape($value); | |||||||||||
| 705 | } | ||||||||||||
| 706 | }; | ||||||||||||
| 707 | 0 | ▶ | /json/ and $data = $self->json->decode($content); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 708 | 0 | ▶ | /(xml|html)/ and $data = $self->xml->XMLin( $content, NoAttr => 0 ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 709 | } | ||||||||||||
| 710 | 0 | return $data; | |||||||||||
| 711 | 0 | }; | |||||||||||
| 712 | } | ||||||||||||
| 713 | |||||||||||||
| 714 | |||||||||||||
| 715 | sub commands { | ||||||||||||
| 716 | 0 | ▶ | my ($self) = @_; | ||||||||||
|
Subroutine
commands: not called CC=1 SCAR=6.9
| |||||||||||||
| 717 | 0 | return $self->endpoints; | |||||||||||
| 718 | } | ||||||||||||
| 719 | |||||||||||||
| 720 | |||||||||||||
| 721 | sub BUILD { | ||||||||||||
| 722 | 1 | ▶ | my ($self) = @_; | ||||||||||
|
Subroutine
BUILD: called CC=2 SCAR=9.9
| |||||||||||||
| 723 | |||||||||||||
| 724 | 1 | ▶ | $self->user_agent( __PACKAGE__ . ' ' . ($Mail::Chimp3::VERSION || '') ); | ||||||||||
|
Condition50%1/2
$Mail::Chimp3::VERSION || ''
MC/DC0%0/1
$Mail::Chimp3::VERSION || ''
$Mail::Chimp3::VERSION
Truth table50%1/2
A
A= $Mail::Chimp3::VERSION
| |||||||||||||
| 725 | 1 | $self->base_url( 'https://' . $self->datacenter . '.api.mailchimp.com/' . $self->api_version ); | |||||||||||
| 726 | 0 | $self->auth_type('basic'); | |||||||||||
| 727 | 0 | $self->user('anystring'); | |||||||||||
| 728 | 0 | $self->content_type('application/json'); | |||||||||||
| 729 | |||||||||||||
| 730 | 0 | return $self; | |||||||||||
| 731 | } | ||||||||||||
| 732 | |||||||||||||
| 733 | |||||||||||||
| 734 | 1; | ||||||||||||
| 735 | |||||||||||||
| 736 | __END__ | ||||||||||||