1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414
|
package Mail::Chimp3;
use 5.010001;
use Moo;
use strictures 2;
use namespace::autoclean 0.16;
use Types::Standard qw/ Num Str /;
with 'Web::API';
# ABSTRACT: An interface to mailchimp.com's RESTful Web API v3 using WEB::API
our $VERSION = '0.08'; # VERSION: generated by DZP::OurPkgVersion
has endpoints => (
is => 'rw',
default => sub {
{
root => { path => '/' },
# authorized apps
authorized_apps => { path => 'authorized-apps' },
authorized_app => { path => 'authorized-apps/:app_id' },
add_authorized_app => {
method => 'POST',
path => 'authorized-apps',
mandatory => [ 'client_id', 'client_secret', ],
},
# automations
automations => { path => 'automations' },
automation => { path => 'automations/:workflow_id' },
pause_automation => {
method => 'POST',
path => 'automations/:workflow_id/actions/pause-all-emails',
},
start_automation => {
method => 'POST',
path => 'automations/:workflow_id/actions/start-all-emails',
},
# automation emails
automation_emails => { path => 'automations/:workflow_id/emails' },
automation_email => { path => 'automations/:workflow_id/emails/:workflow_email_id' },
pause_automation_email => {
method => 'POST',
path => 'automations/:workflow_id/emails/:workflow_email_id/actions/pause',
},
start_automation_email => {
method => 'POST',
path => 'automations/:workflow_id/emails/:workflow_email_id/actions/start',
},
add_automation_subscriber => {
method => 'POST',
path => 'automations/:workflow_id/emails/:workflow_email_id/queue',
mandatory => ['email_address'],
},
automation_subscribers => {
path => 'automations/:workflow_id/emails/:workflow_email_id/queue',
},
automation_subscriber => {
path => 'automations/:workflow_id/emails/:workflow_email_id/queue/:subscriber_hash',
},
remove_automation_subscriber => {
method => 'POST',
path => 'automations/:workflow_id/removed-subscribers',
mandatory => ['email_address'],
},
removed_automation_subscribers => { path => 'automations/:workflow_id/removed-subscribers' },
# batch
batches => { path => 'batches' },
batch => { path => 'batches/:batch_id' },
add_batch => {
method => 'POST',
path => 'batches',
mandatory => ['operations'],
},
delete_batch => {
method => 'DELETE',
path => 'batches/:batch_id',
},
# batch webhooks
batch_webhooks => { path => 'batch-webhooks' },
batch_webhook => { path => 'batch-webhooks/:batch_webhook_id' },
add_batch_webhook => {
method => 'POST',
path => 'batch-webhooks',
mandatory => ['url'],
},
update_batch_webhook => {
method => 'PATCH',
path => 'batch-webhooks/:batch_webhook_id',
mandatory => ['url'],
},
delete_batch_webhook => {
method => 'DELETE',
path => 'batch-webhooks/:batch_webhook_id',
},
# campaign folders
campaign_folders => { path => 'campaign-folders' },
campaign_folder => { path => 'campaign-folders/:folder_id' },
add_campaign_folder => {
method => 'POST',
path => 'campaign-folders',
mandatory => ['name'],
},
update_campaign_folder => {
method => 'PATCH',
path => 'campaign-folders/:folder_id',
mandatory => ['name'],
},
delete_campaign_folder => {
method => 'DELETE',
path => 'campaign-folders/:folder_id',
},
# campaigns
campaigns => { path => 'campaigns' },
campaign => { path => 'campaigns/:campaign_id' },
add_campaign => {
method => 'POST',
path => 'campaigns',
mandatory => [ 'type', 'settings' ],
},
update_campaign => {
method => 'PATCH',
path => 'campaigns/:campaign_id',
mandatory => [ 'type', 'settings' ],
},
delete_campaign => {
method => 'DELETE',
path => 'campaigns/:campaign_id',
},
cancel_campaign => {
method => 'POST',
path => 'campaigns/:campaign_id/actions/cancel-send',
},
pause_campaign => {
method => 'POST',
path => 'campaigns/:campaign_id/actions/pause',
},
replicate_campaign => {
method => 'POST',
path => 'campaigns/:campaign_id/actions/replicate',
},
resume_campaign => {
method => 'POST',
path => 'campaigns/:campaign_id/actions/resume',
},
schedule_campaign => {
method => 'POST',
path => 'campaigns/:campaign_id/actions/schedule',
mandatory => ['schedule_time'],
},
send_campaign => {
method => 'POST',
path => 'campaigns/:campaign_id/actions/send',
},
test_campaign => {
method => 'POST',
path => 'campaigns/:campaign_id/actions/test',
mandatory => [ 'test_emails', 'send_type' ],
},
unschedule_campaign => {
method => 'POST',
path => 'campaigns/:campaign_id/actions/unschedule',
},
campaign_content => { path => 'campaigns/:campaign_id/content' },
set_campaign_content => {
method => 'PUT',
path => 'campaigns/:campaign_id/content',
},
campaign_feedbacks => { path => 'campaigns/:campaign_id/feedback' },
campaign_feedback => { path => 'campaigns/:campaign_id/feedback/:feedback_id' },
add_campaign_feedback => {
method => 'POST',
path => 'campaigns/:campaign_id/feedback',
mandatory => ['message'],
},
update_campaign_feedback => {
method => 'PATCH',
path => 'campaigns/:campaign_id/feedback/:feedback_id',
mandatory => ['message'],
},
delete_campaign_feedback => {
method => 'DELETE',
path => 'campaigns/:campaign_id/feedback/:feedback_id',
},
campaign_send_checklist => { path => 'campaigns/:campaign_id/send-checklist' },
# connected sites
connected_sites => { path => 'connected-sites' },
connected_site => { path => 'connected-sites/:connected_site_id' },
add_connected_site => {
method => 'POST',
path => 'connected-sites',
mandatory => [
qw/
foreign_id
domain
/
],
},
delete_connected_site => {
method => 'DELETE',
path => 'connected-sites/:connected_site_id',
},
verify_connected_site => {
method => 'POST',
path => 'connected-sites/:connected_site_id/actions/verify-script-installation',
},
# conversations
conversations => { path => 'conversations' },
conversation => { path => 'conversations/:conversation_id' },
add_conversation_message => {
method => 'POST',
path => 'conversations/:conversation_id/messages',
mandatory => [ 'from_email', 'read' ],
},
conversation_messages => { path => 'conversation/:conversation_id/messages' },
conversation_message => { path => 'conversation/:conversation_id/messages/:message_id' },
# ecommerce stores
stores => { path => 'ecommerce/stores' },
store => { path => 'ecommerce/stores/:store_id' },
add_store => {
method => 'POST',
path => 'ecommerce/stores',
mandatory => [ 'id', 'list_id', 'name', 'currency_code', ],
},
update_store => {
method => 'PATCH',
path => 'ecommerce/stores/:store_id',
},
delete_store => {
method => 'DELETE',
path => 'ecommerce/stores/:store_id',
},
# ecommerce carts
carts => { path => 'ecommerce/stores/:store_id/carts' },
cart => { path => 'ecommerce/stores/:store_id/carts/:cart_id' },
add_cart => {
method => 'POST',
path => 'ecommerce/stores/:store_id/carts',
mandatory => ['customer'],
},
update_cart => {
method => 'PATCH',
path => 'ecommerce/stores/:store_id/carts/:cart_id',
},
delete_cart => {
method => 'DELETE',
path => 'ecommerce/stores/:store_id/carts/:cart_id',
},
# ecommerce cart lines
cart_lines => { path => 'ecommerce/stores/:store_id/carts/:cart_id/lines' },
cart_line => { path => 'ecommerce/stores/:store_id/carts/:cart_id/lines/:line_id' },
add_cart_line => {
method => 'POST',
path => 'ecommerce/stores/:store_id/carts/:cart_id/lines',
mandatory => [
qw/
id
product_id
product_variant_id
quantity
price
/
],
},
update_cart_line => {
method => 'PATCH',
path => 'ecommerce/stores/:store_id/carts/:cart_id/lines/:line_id',
},
delete_cart_line => {
method => 'DELETE',
path => 'ecommerce/stores/:store_id/carts/:cart_id/lines/:line_id',
},
# ecommerce customers
customers => { path => 'ecommerce/stores/:store_id/customers' },
customer => { path => 'ecommerce/stores/:store_id/customers/:customer_id' },
add_customer => {
method => 'POST',
path => 'ecommerce/stores/:store_id/customers',
mandatory => [
qw/
id
email_address
opt_in_status
/
],
},
update_customer => {
method => 'PATCH',
path => 'ecommerce/stores/:store_id/customers/:customer_id',
},
upsert_customer => {
method => 'PUT',
path => 'ecommerce/stores/:store_id/customers/:customer_id',
mandatory => [
qw/
id
email_address
opt_in_status
/
],
},
delete_customer => {
method => 'DELETE',
path => 'ecommerce/stores/:store_id/customers/:customer_id',
},
# ecommerce orders
orders => { path => 'ecommerce/stores/:store_id/orders' },
order => { path => 'ecommerce/stores/:store_id/orders/:order_id' },
add_order => {
method => 'POST',
path => 'ecommerce/stores/:store_id/orders',
mandatory => [
qw/
id
customer
currency_code
order_total
lines
/
],
},
update_order => {
method => 'PATCH',
path => 'ecommerce/stores/:store_id/orders/:order_id',
},
delete_order => {
method => 'DELETE',
path => 'ecommerce/stores/:store_id/orders/:order_id',
},
# ecommerce order lines
order_lines => { path => 'ecommerce/stores/:store_id/orders/:order_id/lines' },
order_line => { path => 'ecommerce/stores/:store_id/orders/:order_id/lines/:line_id' },
add_order_line => {
method => 'POST',
path => 'ecommerce/stores/:store_id/orders/:order_id/lines',
mandatory => [
qw/
id
product_id
product_variant_id
quantity
price
/
],
},
update_order_line => {
method => 'PATCH',
path => 'ecommerce/stores/:store_id/orders/:order_id/lines/:line_id',
},
delete_order_line => {
method => 'DELETE',
path => 'ecommerce/stores/:store_id/orders/:order_id/lines/:line_id',
},
# ecommerce products
products => { path => 'ecommerce/stores/:store_id/products' },
product => { path => 'ecommerce/stores/:store_id/products/:product_id' },
add_product => {
method => 'POST',
path => 'ecommerce/stores/:store_id/products',
mandatory => [ 'id', 'title', 'variants', ],
},
update_product => {
method => 'PATCH',
path => 'ecommerce/stores/:store_id/products/:product_id',
},
delete_product => {
method => 'DELETE',
path => 'ecommerce/stores/:store_id/products/:product_id',
},
# ecommerce product variants
variants => { path => 'ecommerce/stores/:store_id/products/:product_id/variants' },
variant => { path => 'ecommerce/stores/:store_id/products/:product_id/variants/:variant_id' },
add_variant => {
method => 'POST',
path => 'ecommerce/stores/:store_id/products/:product_id/variants',
mandatory => [ 'id', 'title', ],
},
update_variant => {
method => 'PATCH',
path => 'ecommerce/stores/:store_id/products/:product_id/variants/:variant_id',
},
upsert_variant => {
method => 'PUT',
path => 'ecommerce/stores/:store_id/products/:product_id/variants/:variant_id',
mandatory => [ 'id', 'title', ],
},
delete_variant => {
method => 'DELETE',
path => 'ecommerce/stores/:store_id/products/:product_id/variants/:variant_id',
},
# facebook ads
facebook_ads => { path => 'facebook-ads' },
facebook_ad => { path => 'facebook-ads/:outreach_id' },
# file manager files
file_manager_files => { path => 'file-manager/files' },
file_manager_file => { path => 'file-manager/files/:file_id' },
add_file_manager_file => {
method => 'POST',
path => 'file-manager/files',
mandatory => [ 'name', 'file_data' ],
},
update_file_manager_file => {
method => 'PATCH',
path => 'file-manager/files/:file_id',
mandatory => [ 'name', 'file_data' ],
},
delete_file_manager_file => {
method => 'DELETE',
path => 'file-manager/files/:file_id',
},
# file manager folders
file_manager_folders => { path => 'file-manager/folders' },
file_manager_folder => { path => 'file-manager/folders/:folder_id' },
add_file_manager_folder => {
method => 'POST',
path => 'file-manager/folders',
mandatory => ['name'],
},
update_file_manager_folder => {
method => 'PATCH',
path => 'file-manager/folders/:folder_id',
mandatory => ['name'],
},
delete_file_manager_folder => {
method => 'DELETE',
path => 'file-manager/folders/:folder_id',
},
# google ads
google_ads => { path => 'google-ads' },
google_ads_instance => { path => 'google-ads/:outreach_id' },
# landing pages
landing_pages => { path => 'landing_pages' },
landing_page => { path => 'landing_pages/:page_id' },
landing_page_content => { path => 'landing_pages/:page_id/content' },
add_landing_page => {
method => 'POST',
path => 'landing_pages',
mandatory => [
qw/
list_id
type
/
],
},
update_landing_page => {
method => 'PATCH',
path => 'landing_pages/:page_id',
},
delete_landing_page => {
method => 'DELETE',
path => 'landing_pages/:page_id',
},
publish_landing_page => {
method => 'POST',
path => 'landing_pages/:page_id/actions/publish',
mandatory => ['id'],
},
unpublish_landing_page => {
method => 'POST',
path => 'landing_pages/:page_id/actions/unpublish',
mandatory => ['id'],
},
# lists
lists => { path => 'lists' },
list => { path => 'lists/:list_id' },
add_list => {
method => 'POST',
path => 'lists',
mandatory => [
qw/
name
contact
permission_reminder
campaign_defaults
email_type_option
/
],
},
update_list => {
method => 'PATCH',
path => 'lists/:list_id',
mandatory => [
qw/
name
contact
permission_reminder
campaign_defaults
email_type_option
/
],
},
delete_list => {
method => 'DELETE',
path => 'lists/:list_id',
},
batch_list => {
method => 'POST',
path => 'lists/:list_id',
mandatory => ['members'],
},
abuse_reports => { path => 'lists/:list_id/abuse-reports' },
abuse_report => { path => 'lists/:list_id/abuse-reports/:report_id' },
list_activity => { path => 'lists/:list_id/activity' },
list_clients => { path => 'lists/:list_id/clients' },
growth_history => { path => 'lists/:list_id/growth-history' },
growth_history_month => { path => 'lists/:list_id/growth-history/:month' },
# list interests
interest_categories => { path => 'lists/:list_id/interest-categories' },
interest_category => { path => 'lists/:list_id/interest-categories/:interest_category_id' },
add_interest_category => {
method => 'POST',
path => 'lists/:list_id/interest-categories',
mandatory => [ 'title', 'type' ],
},
update_interest_category => {
method => 'PATCH',
path => 'lists/:list_id/interest-categories/:interest_category_id',
mandatory => [ 'title', 'type' ],
},
delete_interest_category => {
method => 'DELETE',
path => 'lists/:list_id/interest-categories/:interest_category_id',
},
interests => { path => 'lists/:list_id/interest-categories/:interest_category_id/interests' },
interest => { path => 'lists/:list_id/interest-categories/:interest_category_id/interests/:interest_id' },
add_interest => {
method => 'POST',
path => 'lists/:list_id/interest-categories/:interest_category_id/interests',
mandatory => ['name'],
},
update_interest => {
method => 'PATCH',
path => 'lists/:list_id/interest-categories/:interest_category_id/interests/:interest_id',
mandatory => ['name'],
},
delete_interest => {
method => 'DELETE',
path => 'lists/:list_id/interest-categories/:interest_category_id/interests/:interest_id',
},
# list members
members => { path => 'lists/:list_id/members' },
member => { path => 'lists/:list_id/members/:subscriber_hash' },
add_member => {
method => 'POST',
path => 'lists/:list_id/members',
mandatory => [ 'status', 'email_address', ],
},
update_member => {
method => 'PATCH',
path => 'lists/:list_id/members/:subscriber_hash',
},
upsert_member => {
method => 'PUT',
path => 'lists/:list_id/members/:subscriber_hash',
mandatory => [
qw/
email_address
status_if_new
/
],
},
delete_member => {
method => 'DELETE',
path => 'lists/:list_id/members/:subscriber_hash',
},
member_activity => { path => 'lists/:list_id/members/:subscriber_hash/activity' },
member_goals => { path => 'lists/:list_id/members/:subscriber_hash/goals' },
# list member notes
member_notes => { path => 'lists/:list_id/members/:subscriber_hash/notes' },
member_note => { path => 'lists/:list_id/members/:subscriber_hash/notes/:note_id' },
add_member_note => {
method => 'POST',
path => 'lists/:list_id/members/:subscriber_hash/notes',
mandatory => ['note'],
},
update_member_note => {
method => 'POST',
path => 'lists/:list_id/members/:subscriber_hash/notes/:note_id',
mandatory => ['note'],
},
delete_member_note => {
method => 'DELETE',
path => 'lists/:list_id/members/:subscriber_hash/notes/:note_id',
},
# list member tags
member_tags => { path => 'lists/:list_id/members/:subscriber_hash/tags' },
add_member_tag => {
method => 'POST',
path => 'lists/:list_id/members/:subscriber_hash/tags',
mandatory => ['tags'],
},
update_member_tag => {
method => 'POST',
path => 'lists/:list_id/members/:subscriber_hash/tags',
mandatory => ['tags'],
},
# list merge fields
merge_fields => { path => 'lists/:list_id/merge-fields' },
merge_field => { path => 'lists/:list_id/merge-fields/:merge_id' },
add_merge_field => {
method => 'POST',
path => 'lists/:list_id/merge-fields',
mandatory => [ 'name', 'type', ],
},
update_merge_field => {
method => 'PATCH',
path => 'lists/:list_id/merge-fields/:merge_id',
},
delete_merge_field => {
method => 'DELETE',
path => 'lists/:list_id/merge-fields/:merge_id',
},
# list segments
segments => { path => 'lists/:list_id/segments' },
segment => { path => 'lists/:list_id/segments/:segment_id' },
add_segment => {
method => 'POST',
path => 'lists/:list_id/segments',
mandatory => ['name'],
},
update_segment => {
method => 'PATCH',
path => 'lists/:list_id/segments/:segment_id',
},
delete_segment => {
method => 'DELETE',
path => 'lists/:list_id/segments/:segment_id',
},
segment_members => { path => 'lists/:list_id/segments/:segment_id/members' },
add_segment_member => {
method => 'POST',
path => 'lists/:list_id/segments/:segment_id/members'
},
delete_segment_member => {
method => 'DELETE',
path => 'lists/:list_id/segments/:segment_id/members/:subscriber_hash'
},
batch_segment => {
method => 'POST',
path => 'lists/:list_id/segments/:segment_id',
},
# list other
twitter_cards => { path => 'lists/:list_id/twitter-lead-gen-cards' },
twitter_card => { path => 'lists/:list_id/twitter-lead-gen-cards/:twitter_card_id' },
add_twitter_card => {
method => 'POST',
path => 'lists/:list_id/twitter-lead-gen-cards',
mandatory => [
qw/
name
title
cta_text
privacy_policy_url
image_url
twitter_account_id
/
],
},
webhooks => { path => 'lists/:list_id/webhooks' },
webhook => { path => 'lists/:list_id/webhooks/:webhook_id' },
add_webhook => {
method => 'POST',
path => 'lists/:list_id/webhooks'
},
delete_webhook => {
method => 'DELETE',
path => 'lists/:list_id/webhooks/:webhook_id'
},
# ping
ping => { path => 'ping' },
# reporting
reporting => { path => 'reporting' },
reporting_facebook_ads => { path => 'reporting/facebook-ads' },
reporting_facebook_ad => { path => 'reporting/facebook-ads/:outreach_id' },
reporting_facebook_ad_ecommerce => { path => 'reporting/facebook-ads/:outreach_id/ecommerce-product-activity' },
reporting_google_ads => { path => 'reporting/google-ads' },
reporting_google_ad => { path => 'reporting/google-ads/:outreach_id' },
reporting_google_ad_ecommerce => { path => 'reporting/google-ads/:outreach_id/ecommerce-product-activity' },
reporting_landing_pages => { path => 'reporting/landing-pages' },
reporting_landing_page => { path => 'reporting/landing-pages/:outreach_id' },
# reports
reports => { path => 'reports' },
report => { path => 'reports/:campaign_id' },
abuse_reports => { path => 'reports/:campaign_id/abuse-reports' },
abuse_report => { path => 'reports/:campaign_id/abuse-reports/:report_id' },
advice => { path => 'reports/:campaign_id/advice' },
click_details => { path => 'reports/:campaign_id/click-details' },
click_detail => { path => 'reports/:campaign_id/click-details/:link_id' },
click_details_members => { path => 'reports/:campaign_id/click-details/:link_id/members' },
click_details_member => { path => 'reports/:campaign_id/click-details/:link_id/members/:subscriber_hash' },
domain_performance => { path => 'reports/:campaign_id/domain-performance' },
eepurl => { path => 'reports/:campaign_id/eepurl' },
email_activity => { path => 'reports/:campaign_id/email-activity' },
member_email_activity => { path => 'reports/:campaign_id/email-activity/:subscriber_hash' },
locations => { path => 'reports/:campaign_id/locations' },
sent_to => { path => 'reports/:campaign_id/sent-to' },
member_sent_to => { path => 'reports/:campaign_id/sent-to/:subscriber_hash' },
sub_reports => { path => 'reports/:campaign_id/sub-reports' },
unsubscribed => { path => 'reports/:campaign_id/unsubscribed' },
member_unsubscribed => { path => 'reports/:campaign_id/unsubscribed/:subscriber_hash' },
# search campaigns
search_campaigns => { path => 'search-campaigns' },
# search members
search_members => { path => 'search-members' },
# template folders
template_folders => { path => 'template-folders' },
template_folder => { path => 'template-folders/:folder_id' },
add_template_folder => {
method => 'POST',
path => 'template-folders',
mandatory => ['name'],
},
update_template_folder => {
method => 'PATCH',
path => 'template-folders/:folder_id',
mandatory => ['name'],
},
delete_template_folder => {
method => 'DELETE',
path => 'template-folders/:folder_id',
},
# templates
templates => { path => 'templates' },
template => { path => 'templates/:template_id' },
add_template => {
method => 'POST',
path => 'templates',
mandatory => [ 'name', 'html' ],
},
update_template => {
method => 'PATCH',
path => 'templates/:template_id',
mandatory => [ 'name', 'html' ],
},
delete_template => {
method => 'DELETE',
path => 'templates/:template_id',
},
template_default_content => { path => 'templates/:template_id/default-content' },
# verified domains
verified_domains => { path => 'verified_domains' },
verified_domain_name => { path => 'verified_domains/:domain_name' },
add_domain_name => {
method => 'POST',
path => 'verified_domains',
},
delete_domain_name => {
method => 'DELETE',
path => 'verified_domains/:domain_name',
},
verify_domain_name => {
method => 'POST',
path => 'verified_domains/:domain_name/actions/verify',
},
};
},
);
has chimp_api_version => (
is => 'ro',
isa => Num,
default => sub { '3.0' },
);
has chimp_datacenter => (
is => 'lazy',
isa => Str,
default => sub {
my $self = shift;
if ($self->api_key) {
my ($dc) = ( $self->api_key =~ /\-(\w+)$/ );
return $dc;
}
else {
return 'us1';
}
},
);
has '+decoder' => (
builder => 1,
);
sub _build_decoder {
my $self = shift;
return sub {
my ($content, $content_type) = @_;
my $data = {};
return $data unless $content;
for ($content_type) {
/plain/ and do {
chomp $content;
$data = { text => $content };
};
/urlencoded/ and do {
for (split /&/, $content) {
my ($key, $value) = split /=/;
$data->{ uri_unescape($key) } = uri_unescape($value);
}
};
/json/ and $data = $self->json->decode($content);
/(xml|html)/ and $data = $self->xml->XMLin( $content, NoAttr => 0 );
}
return $data;
};
}
sub commands {
my ($self) = @_;
return $self->endpoints;
}
sub BUILD {
my ($self) = @_;
$self->user_agent( __PACKAGE__ . ' ' . ($Mail::Chimp3::VERSION || '') );
$self->base_url( 'https://' . $self->chimp_datacenter . '.api.mailchimp.com/' . $self->chimp_api_version );
$self->auth_type('basic');
$self->user('anystring');
$self->content_type('application/json');
return $self;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Mail::Chimp3 - An interface to mailchimp.com's RESTful Web API v3 using WEB::API
=head1 VERSION
version 0.08
=head1 SYNOPSIS
This is for the MailChimp API v3.0.
Please refer to the API documentation at
L<http://developer.mailchimp.com/documentation/mailchimp/reference/overview/>
use Mail::Chimp3;
my $mailchimp = Mail::Chimp3->new(
api_key => $apikey,
);
my $response = $mailchimp->add_store(
store_id => '123',
cart_id => '456',
);
=head1 METHODS
=over
=item abuse_report
=item abuse_reports
=item add_authorized_app
=item add_automation_subscriber
=item add_batch
=item add_batch_webhook
=item add_campaign
=item add_campaign_feedback
=item add_campaign_folder
=item add_cart
=item add_cart_line
=item add_connected_site
=item add_conversation_message
=item add_customer
=item add_domain_name
=item add_file_manager_file
=item add_file_manager_folder
=item add_interest
=item add_interest_category
=item add_landing_page
=item add_list
=item add_member
=item add_member_note
=item add_member_tag
=item add_merge_field
=item add_order
=item add_order_line
=item add_product
=item add_segment
=item add_segment_member
=item add_store
=item add_template
=item add_template_folder
=item add_twitter_card
=item add_variant
=item add_webhook
=item advice
=item authorized_app
=item authorized_apps
=item automation
=item automation_email
=item automation_emails
=item automation_subscriber
=item automation_subscribers
=item automations
=item batch
=item batches
=item batch_list
=item batch_segment
=item batch_webhooks
=item batch_webhook
=item campaign
=item campaign_content
=item campaign_feedback
=item campaign_feedbacks
=item campaign_folder
=item campaign_folders
=item campaign_send_checklist
=item campaigns
=item cancel_campaign
=item cart
=item cart_line
=item cart_lines
=item carts
=item click_detail
=item click_details
=item click_details_member
=item click_details_members
=item connected_sites
=item connected_site
=item conversation
=item conversation_message
=item conversation_messages
=item conversations
=item customer
=item customers
=item delete_batch
=item delete_batch_webhook
=item delete_campaign
=item delete_campaign_feedback
=item delete_campaign_folder
=item delete_cart
=item delete_cart_line
=item delete_connected_site
=item delete_customer
=item delete_domain_name
=item delete_file_manager_file
=item delete_file_manager_folder
=item delete_interest
=item delete_interest_category
=item delete_landing_page
=item delete_list
=item delete_member
=item delete_member_note
=item delete_merge_field
=item delete_order
=item delete_order_line
=item delete_product
=item delete_segment
=item delete_segment_member
=item delete_store
=item delete_template
=item delete_template_folder
=item delete_variant
=item delete_webhook
=item domain_performance
=item eepurl
=item email_activity
=item facebook_ad
=item facebook_ads
=item file_manager_file
=item file_manager_files
=item file_manager_folder
=item file_manager_folders
=item growth_history
=item growth_history_month
=item google_ads
=item google_ads_instance
=item interest
=item interest_categories
=item interest_category
=item interests
=item landing_page
=item landing_page_content
=item landing_pages
=item list
=item list_activity
=item list_clients
=item lists
=item locations
=item member
=item member_activity
=item member_email_activity
=item member_goals
=item member_note
=item member_notes
=item member_tags
=item member_sent_to
=item member_unsubscribed
=item members
=item merge_field
=item merge_fields
=item order
=item order_line
=item order_lines
=item orders
=item pause_automation
=item pause_automation_email
=item pause_campaign
=item ping
=item product
=item products
=item publish_landing_page
=item remove_automation_subscriber
=item removed_automation_subscribers
=item replicate_campaign
=item report
=item reports
=item reporting
=item reporting_facebook_ad
=item reporting_facebook_ad_ecommerce
=item reporting_facebook_ads
=item reporting_google_ad
=item reporting_google_ad_ecommerce
=item reporting_google_ads
=item reporting_landing_page
=item reporting_landing_pages
=item resume_campaign
=item root
=item schedule_campaign
=item search_campaigns
=item search_members
=item segment
=item segment_members
=item segments
=item send_campaign
=item sent_to
=item set_campaign_content
=item start_automation
=item start_automation_email
=item store
=item stores
=item sub_reports
=item template
=item template_default_content
=item template_folder
=item template_folders
=item templates
=item test_campaign
=item twitter_card
=item twitter_cards
=item unpublish_landing_page
=item unschedule_campaign
=item unsubscribed
=item update_batch_webhook
=item update_campaign
=item update_campaign_feedback
=item update_campaign_folder
=item update_cart
=item update_cart_line
=item update_customer
=item update_file_manager_file
=item update_file_manager_folder
=item update_interest
=item update_interest_category
=item update_landing_page
=item update_list
=item update_member
=item update_member_note
=item update_merge_field
=item update_order
=item update_order_line
=item update_product
=item update_segment
=item update_store
=item update_template
=item update_template_folder
=item update_variant
=item upsert_customer
=item upsert_member
=item upsert_variant
=item variant
=item variants
=item verified_domains
=item verified_domain_name
=item verify_connected_site
=item verify_domain_name
=item webhook
=item webhooks
=back
=head1 INTERNALS
=over
=item commands
Required by Web::API
=back
=head2 BUILD
basic configuration for the client API happens usually in the BUILD method when using Web::API
=head1 BUGS
Please report any bugs or feature requests on GitHub's issue tracker L<https://github.com/jdigory/p5-Mail-Chimp3/issues>.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Mail::Chimp3
You can also look for information at:
=over 4
=item * GitHub repository
L<https://github.com/jdigory/p5-Mail-Chimp3>
=back
=head1 CONTRIBUTORS
Peter Karman (pkarman)
=head1 AUTHOR
Josh Lavin <digory@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Josh Lavin.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|