WP Mail SMTP by WPForms - Version 1.6.0

Version Description

  • 2019-08-21 =
  • Added: New transactional mailer: Sendinblue.
  • Added: Educate users to use transactional mailers for better deliverability.
  • Added: New option and filter to disable admin area delivery error notices.
  • Changed: Hide private API key saved in the DB for API based mailers using input[type=password].
  • Changed: Update links to various docs, pointing now to https://wpmailsmtp.com.
Download this release

Release Info

Developer slaFFik
Plugin Icon 128x128 WP Mail SMTP by WPForms
Version 1.6.0
Comparing to
See all releases

Code changes from version 1.5.2 to 1.6.0

Files changed (54) hide show
  1. assets/css/smtp-admin.min.css +1 -1
  2. assets/css/smtp-logs.min.css +0 -3
  3. assets/images/control/admin.png +0 -0
  4. assets/images/control/comments.png +0 -0
  5. assets/images/control/personal.png +0 -0
  6. assets/images/control/update.png +0 -0
  7. assets/images/control/user_new.png +0 -0
  8. assets/images/control/users.png +0 -0
  9. assets/images/logs/archive.png +0 -0
  10. assets/images/logs/single.png +0 -0
  11. assets/images/recommended.svg +1 -0
  12. assets/images/sendinblue.svg +1 -0
  13. assets/js/smtp-admin.js +197 -76
  14. assets/js/smtp-admin.min.js +1 -1
  15. assets/languages/wp-mail-smtp.pot +369 -263
  16. readme.txt +31 -126
  17. src/Admin/Area.php +42 -9
  18. src/Admin/Pages/About.php +1 -1
  19. src/Admin/Pages/{Auth.php → AuthTab.php} +2 -2
  20. src/Admin/Pages/ControlTab.php +124 -0
  21. src/Admin/Pages/Logs.php +15 -37
  22. src/Admin/Pages/LogsTab.php +73 -0
  23. src/Admin/Pages/{Misc.php → MiscTab.php} +51 -3
  24. src/Admin/Pages/{Settings.php → SettingsTab.php} +23 -4
  25. src/Admin/Pages/{Test.php → TestTab.php} +2 -2
  26. src/Core.php +42 -41
  27. src/Debug.php +8 -4
  28. src/Geo.php +19 -0
  29. src/Migration.php +1 -1
  30. src/Options.php +35 -10
  31. src/Providers/Gmail/Options.php +8 -7
  32. src/Providers/Loader.php +8 -6
  33. src/Providers/MailerAbstract.php +44 -27
  34. src/Providers/Mailgun/Options.php +2 -2
  35. src/Providers/OptionsAbstract.php +75 -12
  36. src/Providers/Sendgrid/Mailer.php +2 -7
  37. src/Providers/Sendgrid/Options.php +1 -1
  38. src/Providers/Sendinblue/Api.php +93 -0
  39. src/Providers/Sendinblue/Mailer.php +393 -0
  40. src/Providers/Sendinblue/Options.php +119 -0
  41. vendor/composer/autoload_psr4.php +1 -0
  42. vendor/composer/autoload_static.php +8 -0
  43. vendor/google/apiclient-services/src/Google/Service/Gmail.php +4 -3
  44. vendor/google/auth/src/Cache/SysVCacheItemPool.php +61 -48
  45. vendor/google/auth/src/Credentials/GCECredentials.php +6 -2
  46. vendor/sendinblue/api-v3-sdk/lib/Api/AccountApi.php +356 -0
  47. vendor/sendinblue/api-v3-sdk/lib/Api/AttributesApi.php +1186 -0
  48. vendor/sendinblue/api-v3-sdk/lib/Api/ContactsApi.php +7380 -0
  49. vendor/sendinblue/api-v3-sdk/lib/Api/EmailCampaignsApi.php +2851 -0
  50. vendor/sendinblue/api-v3-sdk/lib/Api/FoldersApi.php +1787 -0
  51. vendor/sendinblue/api-v3-sdk/lib/Api/ListsApi.php +2698 -0
  52. vendor/sendinblue/api-v3-sdk/lib/Api/ProcessApi.php +674 -0
  53. vendor/sendinblue/api-v3-sdk/lib/Api/ResellerApi.php +4327 -0
  54. vendor/sendinblue/api-v3-sdk/lib/Api/SMSCampaignsApi.php +1703 -0
assets/css/smtp-admin.min.css CHANGED
@@ -1,3 +1,3 @@
1
- #wpcontent{padding-left:0 !important;position:relative}@media (max-width: 600px){#wpcontent{padding-top:46px}}@media (max-width: 600px){#wpbody{padding-top:0}}#wp-mail-smtp-header{background-color:#f1f3f7;border-top:3px solid #FF982D;padding:20px}#wp-mail-smtp-header img{display:block;margin:0;max-width:242px}@media (max-width: 782px){#wp-mail-smtp-header img{max-width:200px}}#wp-mail-smtp{margin:0}#wp-mail-smtp .wp-mail-smtp-hide{display:none}#wp-mail-smtp .wp-mail-smtp-page-title{background-color:#fff;font-size:14px;margin:0 0 20px 0;padding:0 20px}#wp-mail-smtp .wp-mail-smtp-page-title a.tab{border-bottom:2px solid #fff;box-shadow:none;color:#666;display:inline-block;margin-right:30px;padding:20px 0 18px 0;text-decoration:none}#wp-mail-smtp .wp-mail-smtp-page-title a.tab.active{border-bottom:2px solid #FF982D}#wp-mail-smtp .wp-mail-smtp-page-title a.tab:hover{border-color:#999}#wp-mail-smtp .wp-mail-smtp-page-title a.action{padding:5px;border:0;min-height:auto;color:#fff;margin:-10px 0 0 20px}#wp-mail-smtp .wp-mail-smtp-page-title .page-title{background-color:#fff;display:inline-block;font-size:23px;margin:0;padding:20px 20px 20px 0}#wp-mail-smtp .wp-mail-smtp-page-content{padding:0 20px}#wp-mail-smtp .wp-mail-smtp-page-content *,#wp-mail-smtp .wp-mail-smtp-page-content *::before,#wp-mail-smtp .wp-mail-smtp-page-content *::after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-clear:before{content:" ";display:table}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-clear:after{clear:both;content:" ";display:table}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row{border-bottom:1px solid #e4e4e4;padding:30px 0;font-size:14px;line-height:1.3}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row:first-of-type{padding-top:10px !important}@media (max-width: 781px){#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row{padding:20px 0}}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.inactive{display:none}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row .wp-mail-smtp-setting-mid-row-sep{background:#e4e4e4;height:1px;border:0;margin:15px 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.section-heading{padding:20px 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.section-heading.no-desc h2,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.section-heading.no-desc h4{margin:0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.section-heading .wp-mail-smtp-setting-field{margin:0;max-width:1000px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox input[type=checkbox]{float:left;margin:1px 0 0 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox input[type=checkbox]+label{margin:0 0 0 8px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox .desc{margin:0 0 0 30px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox input[type=checkbox]+label+.desc{margin:8px 0 0 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-text .wp-mail-smtp-setting-label,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-password .wp-mail-smtp-setting-label,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-number .wp-mail-smtp-setting-label,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-email .wp-mail-smtp-setting-label{padding-top:8px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-select .wp-mail-smtp-setting-label{padding-top:8px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-radio .wp-mail-smtp-setting-field input[type=radio]{margin:-3px 10px 0 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-radio .wp-mail-smtp-setting-field label{margin-right:30px;display:inline-block}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field label{vertical-align:middle;display:inline-block}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field label:hover .wp-mail-smtp-setting-toggle-switch{background-color:#999}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]{display:none}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:checked+.wp-mail-smtp-setting-toggle-switch{background-color:#46B450}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:checked+.wp-mail-smtp-setting-toggle-switch:before{-webkit-transform:translateX(19px);-ms-transform:translateX(19px);transform:translateX(19px)}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:disabled+.wp-mail-smtp-setting-toggle-switch{background-color:#69c471;cursor:default}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:checked+.wp-mail-smtp-setting-toggle-switch+.wp-mail-smtp-setting-toggle-checked-label{display:inline-block}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:checked+.wp-mail-smtp-setting-toggle-switch+.wp-mail-smtp-setting-toggle-checked-label+.wp-mail-smtp-setting-toggle-unchecked-label{display:none}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:disabled+.wp-mail-smtp-setting-toggle-switch+.wp-mail-smtp-setting-toggle-checked-label,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:disabled+.wp-mail-smtp-setting-toggle-switch+.wp-mail-smtp-setting-toggle-unchecked-label{color:#aaa}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field .wp-mail-smtp-setting-toggle-unchecked-label,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field .wp-mail-smtp-setting-toggle-checked-label{text-transform:uppercase;font-weight:400;color:#777;font-size:13px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field .wp-mail-smtp-setting-toggle-checked-label{display:none}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field .wp-mail-smtp-setting-toggle-switch{position:relative;cursor:pointer;background-color:#ccc;border-radius:15px;-webkit-transition:all 0.2s ease-in-out;-moz-transition:all 0.2s ease-in-out;-ms-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;vertical-align:middle;position:relative;display:inline-block;margin:0 5px 0 0;width:40px;height:20px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field .wp-mail-smtp-setting-toggle-switch:before{position:absolute;content:"";height:14px;width:14px;left:3px;top:3px;background-color:#fff;border-radius:50%;-webkit-transition:all 0.2s ease-in-out;-moz-transition:all 0.2s ease-in-out;-ms-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer{padding-bottom:20px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer{display:inline-block;width:140px;margin-right:10px;margin-bottom:10px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer:last-child{margin-right:0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer .wp-mail-smtp-mailer-image{background:#fff;text-align:center;border:2px solid #E5E5E5;border-radius:4px;height:76px;position:relative;margin-bottom:10px;cursor:pointer;-webkit-transition:all 0.2s ease-in-out;-moz-transition:all 0.2s ease-in-out;-ms-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer .wp-mail-smtp-mailer-image img{max-width:90%;max-height:40px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);opacity:0.6;-webkit-transition:all 0.2s ease-in-out;-moz-transition:all 0.2s ease-in-out;-ms-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer.wp-mail-smtp-mailer-smtp .wp-mail-smtp-mailer-image img{max-height:30px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer.active .wp-mail-smtp-mailer-image{border-color:#FF982D}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer.active .wp-mail-smtp-mailer-image img{opacity:1}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer:hover .wp-mail-smtp-mailer-image{border-color:#ccc}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer:hover .wp-mail-smtp-mailer-image img{opacity:1}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row h2,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row h4{color:#444;font-size:20px;font-weight:700;margin:0 0 6px 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row h3{color:#444;font-size:24px;font-weight:600;margin:0 0 20px 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p{margin:12px 0 0;font-size:14px;line-height:1.3}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p:first-of-type{margin:8px 0 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p.desc{font-style:italic;color:#777}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p.inline-error{margin:5px 0 15px;box-sizing:border-box;background:#fff;border-left:4px solid #dc3232;box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);padding:10px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row ul{margin:8px 0 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row ul.list li{margin-left:20px;list-style-type:disc}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list th{padding:5px 5px 5px 0;text-align:left}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.email{padding-right:2em}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.status{width:100px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.actions a{border-bottom:1px solid;display:inline-block;margin-right:5px;text-decoration:none}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.actions a[class*=delete]{color:#a00}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.actions a[class*=delete]:hover,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.actions a[class*=delete]:active,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.actions a[class*=delete]:focus{color:#400}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=text],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=email],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=number],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=password]{background-color:#fff;border:1px solid #ddd;border-radius:3px;box-shadow:none;color:#333;display:inline-block;vertical-align:middle;padding:7px 12px;margin:0 10px 0 0;width:400px;min-height:35px}@media (max-width: 959px){#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=text],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=email],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=number],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=password]{width:300px}}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=text][readonly],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=email][readonly],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=number][readonly],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=password][readonly]{background-color:#f9f9f9}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=text].small-text,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=email].small-text,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=number].small-text,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=password].small-text{width:75px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=text]:focus,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=email]:focus,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=number]:focus,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=password]:focus{border-color:#bbb}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=text]:disabled,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=email]:disabled,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=number]:disabled,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=password]:disabled{opacity:0.6}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-label{display:block;float:left;width:200px;padding:0 20px 0 0}@media (max-width: 781px){#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-label{float:none;width:100%;padding-bottom:15px}}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-label label{display:block;font-weight:600;font-size:1.1em}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-field{display:block;margin:0 0 0 200px;max-width:1064px}@media (max-width: 781px){#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-field{margin:0}}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-submit{margin:0;padding:25px 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-submit .help-text{margin-left:10px;vertical-align:middle}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-mailer-options .wp-mail-smtp-mailer-option .wp-mail-smtp-setting-row.section-heading{padding:20px 0 !important}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-mailer-options .wp-mail-smtp-mailer-option blockquote{background:#E5E5E5;border-radius:4px;color:#666;font-size:14px;margin:20px 0;padding:15px}#wp-mail-smtp .wp-mail-smtp-page-content.wp-mail-smtp-page-general p{margin:0}#wp-mail-smtp .wp-mail-smtp-page-content .notice-inline{background:#fff;border-left:4px solid #fff;box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);margin:5px 0 15px;padding:1px 12px}#wp-mail-smtp .wp-mail-smtp-page-content .notice-inline.notice-success{border-left-color:#46b450}#wp-mail-smtp .wp-mail-smtp-page-content .notice-inline.notice-warning{border-left-color:#ffb900}#wp-mail-smtp .wp-mail-smtp-page-content .notice-inline.notice-error{border-left-color:#dc3232}#wp-mail-smtp .wp-mail-smtp-page-content .notice-inline.notice-info{border-left-color:#00a0d2}#wp-mail-smtp .wp-mail-smtp-page-content .notice p,#wp-mail-smtp .wp-mail-smtp-page-content .notice-inline p{margin:0.5em 0;padding:2px}#wp-mail-smtp .wp-mail-smtp-page-content pre{white-space:pre-line}#wp-mail-smtp .wp-mail-smtp-page-content.active{display:block}#wp-mail-smtp .wp-mail-smtp-page-content .connected-as{margin-left:30px}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug{background-color:#fff;padding:25px 20px 1px 25px}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug h2{color:#444;margin:1.4em 0 0.8em;font-size:16px;font-weight:700}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug p{font-size:14px;color:#555;margin-bottom:1.1em}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ul,#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ol{font-size:14px;color:#555;margin:0 0 1.1em 1.8em}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ul li,#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ol li{margin:0 0 8px 0;line-height:1.5}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ul li:last-of-type,#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ol li:last-of-type{margin:0}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ul li ul,#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ol li ul{list-style-type:disc}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug a{color:#FF982D}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug a:hover{color:#f97f00}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .dashicons-star-filled{color:#FF982D;width:16px;height:16px;font-size:16px;vertical-align:text-top}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .price-off{color:green;font-weight:bold}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .error-log-toggle{text-decoration:none;color:#444}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .error-log-toggle:hover{color:#FF982D}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .error-log-toggle .dashicons{font-size:15px;height:15px;width:15px;padding-top:3px;border:0;outline:0}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .error-log{border-left:3px solid #ffb900;padding:0 0 0 20px;margin:0 0 10px 0;font-size:12px;display:none}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .error-log pre{margin:0}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .error-log-note{display:none}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner{background-color:#fff;padding:25px 20px;border:1px solid #dadada;margin:10px 0 0 0;position:relative}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .wp-mail-smtp-pro-banner-dismiss{position:absolute;right:10px;top:10px}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .wp-mail-smtp-pro-banner-dismiss button{background:none;border:none;color:#a9a9a9;cursor:pointer;margin:0;padding:0}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner h2{color:#444;margin-top:0;font-size:16px;font-weight:700}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner p{font-size:14px;color:#555;margin-bottom:1.1em}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner p:last-of-type{margin:0}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .benefits{margin:0 0 16px 0;overflow:auto;max-width:1000px}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .benefits ul{margin:0;padding:0;width:50%;float:left}@media (max-width: 600px){#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .benefits ul{width:100%;float:none}}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .benefits ul li{margin:0;padding:0 0 2px 16px;color:#555;font-size:14px;position:relative}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .benefits ul li:before{content:'+';position:absolute;top:-1px;left:0}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .benefits ul li.arrow-right:before{content:'→'}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner a{color:#FF982D}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner a:hover,#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner a:active,#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner a:focus{color:#f97f00}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .stars{text-decoration:none}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .stars .dashicons{width:16px;height:16px;font-size:16px;vertical-align:text-top}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .price-off{color:green;font-weight:bold}#wp-mail-smtp .wp-mail-smtp-admin-columns>div[class*="-column-"]{float:left}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-20{width:20%}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-33{width:33.33333%}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-40{width:40%}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-50{width:50%}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-60{width:60%}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-80{width:80%}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-last{float:right !important}#wp-mail-smtp .wp-mail-smtp-admin-columns:after{content:"";display:table;clear:both}.wp-mail-smtp-btn{border:0;border-radius:3px;cursor:pointer;display:inline-block;margin:0;text-decoration:none;text-align:center;vertical-align:middle;white-space:nowrap;text-shadow:none;box-shadow:none;outline:none}.wp-mail-smtp-btn .dashicons{font-size:16px;width:16px;height:16px}.wp-mail-smtp-btn:disabled{opacity:0.5;cursor:not-allowed}.wp-mail-smtp-btn.wp-mail-smtp-btn-md{font-size:13px;font-weight:600;padding:8px 12px;min-height:35px}.wp-mail-smtp-btn.wp-mail-smtp-btn-lg{font-size:16px;font-weight:600;padding:16px 28px}.wp-mail-smtp-btn.wp-mail-smtp-btn-orange{background-color:#FF982D;border-color:#FF982D;color:#fff}.wp-mail-smtp-btn.wp-mail-smtp-btn-orange:hover,.wp-mail-smtp-btn.wp-mail-smtp-btn-orange:active,.wp-mail-smtp-btn.wp-mail-smtp-btn-orange:focus{background-color:#f97f00;border-color:#f97f00}.wp-mail-smtp-btn.wp-mail-smtp-btn-red{background-color:#DC3232;border-color:#DC3232;color:#fff}.wp-mail-smtp-btn.wp-mail-smtp-btn-red:hover,.wp-mail-smtp-btn.wp-mail-smtp-btn-red:active,.wp-mail-smtp-btn.wp-mail-smtp-btn-red:focus{background-color:darkred;border-color:darkred}.wp-mail-smtp-btn.wp-mail-smtp-btn-grey{background-color:#f5f5f5;border:1px solid #ccc;color:#666}.wp-mail-smtp-btn.wp-mail-smtp-btn-grey:hover,.wp-mail-smtp-btn.wp-mail-smtp-btn-grey:active,.wp-mail-smtp-btn.wp-mail-smtp-btn-grey:focus{background-color:#d7d7d7;border-color:#ccc;color:#444}.wp-mail-smtp-btn.wp-mail-smtp-btn-light-grey{background-color:#f5f5f5;border:1px solid #ccc;color:#666}.wp-mail-smtp-btn.wp-mail-smtp-btn-light-grey:hover,.wp-mail-smtp-btn.wp-mail-smtp-btn-light-grey:active,.wp-mail-smtp-btn.wp-mail-smtp-btn-light-grey:focus{background-color:#eee;color:#444}
2
 
3
  /*# sourceMappingURL=smtp-admin.min.css.map */
1
+ #wpcontent{padding-left:0 !important;position:relative}@media (max-width: 600px){#wpcontent{padding-top:46px}}@media (max-width: 600px){#wpbody{padding-top:0}}#wp-mail-smtp-header{border-top:3px solid #FF982D;padding:20px}#wp-mail-smtp-header img{display:block;margin:0;max-width:242px}@media (max-width: 782px){#wp-mail-smtp-header img{max-width:200px}}#wp-mail-smtp{margin:0}#wp-mail-smtp .wp-mail-smtp-hide{display:none}#wp-mail-smtp .wp-mail-smtp-page-title{background-color:#fff;font-size:14px;margin:0 0 20px 0;padding:0 20px}#wp-mail-smtp .wp-mail-smtp-page-title a.tab{border-bottom:2px solid #fff;box-shadow:none;color:#666;display:inline-block;margin-right:30px;padding:20px 0 18px 0;text-decoration:none}#wp-mail-smtp .wp-mail-smtp-page-title a.tab.active{border-bottom:2px solid #FF982D}#wp-mail-smtp .wp-mail-smtp-page-title a.tab:hover{border-color:#999}#wp-mail-smtp .wp-mail-smtp-page-title a.action{padding:5px;border:0;min-height:auto;color:#fff;margin:-10px 0 0 20px}#wp-mail-smtp .wp-mail-smtp-page-title .page-title{background-color:#fff;display:inline-block;font-size:23px;margin:0;padding:15px 20px 15px 0}#wp-mail-smtp .wp-mail-smtp-page-content{padding:0 20px}#wp-mail-smtp .wp-mail-smtp-page-content *,#wp-mail-smtp .wp-mail-smtp-page-content *::before,#wp-mail-smtp .wp-mail-smtp-page-content *::after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-clear:before{content:" ";display:table}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-clear:after{clear:both;content:" ";display:table}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row{border-bottom:1px solid #e4e4e4;padding:30px 0;font-size:14px;line-height:1.3}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row:first-of-type{padding-top:10px !important}@media (max-width: 781px){#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row{padding:20px 0}}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.inactive{display:none}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row .wp-mail-smtp-setting-mid-row-sep{background:#e4e4e4;height:1px;border:0;margin:15px 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.section-heading{padding:20px 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.section-heading.no-desc h2,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.section-heading.no-desc h4{margin:0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.section-heading .wp-mail-smtp-setting-field{margin:0;max-width:1005px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox input[type=checkbox]{float:left;margin:1px 0 0 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox input[type=checkbox]+label{margin:0 0 0 8px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox .desc{margin:0 0 0 30px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox input[type=checkbox]+label+.desc{margin:8px 0 0 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-text .wp-mail-smtp-setting-label,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-password .wp-mail-smtp-setting-label,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-number .wp-mail-smtp-setting-label,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-email .wp-mail-smtp-setting-label{padding-top:8px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-select .wp-mail-smtp-setting-label{padding-top:8px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-radio .wp-mail-smtp-setting-field input[type=radio]{margin:-3px 10px 0 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-radio .wp-mail-smtp-setting-field label{margin-right:30px;display:inline-block}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field label{vertical-align:middle;display:inline-block}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field label:hover .wp-mail-smtp-setting-toggle-switch{background-color:#999}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]{display:none}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:checked+.wp-mail-smtp-setting-toggle-switch{background-color:#46B450}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:checked+.wp-mail-smtp-setting-toggle-switch:before{-webkit-transform:translateX(19px);-ms-transform:translateX(19px);transform:translateX(19px)}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:disabled+.wp-mail-smtp-setting-toggle-switch{background-color:#69c471;cursor:default}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:checked+.wp-mail-smtp-setting-toggle-switch+.wp-mail-smtp-setting-toggle-checked-label{display:inline-block}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:checked+.wp-mail-smtp-setting-toggle-switch+.wp-mail-smtp-setting-toggle-checked-label+.wp-mail-smtp-setting-toggle-unchecked-label{display:none}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:disabled+.wp-mail-smtp-setting-toggle-switch+.wp-mail-smtp-setting-toggle-checked-label,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field input[type=checkbox]:disabled+.wp-mail-smtp-setting-toggle-switch+.wp-mail-smtp-setting-toggle-unchecked-label{color:#aaa}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field .wp-mail-smtp-setting-toggle-unchecked-label,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field .wp-mail-smtp-setting-toggle-checked-label{text-transform:uppercase;font-weight:400;color:#777;font-size:13px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field .wp-mail-smtp-setting-toggle-checked-label{display:none}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field .wp-mail-smtp-setting-toggle-switch{position:relative;cursor:pointer;background-color:#ccc;border-radius:15px;-webkit-transition:all 0.2s ease-in-out;-moz-transition:all 0.2s ease-in-out;-ms-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;vertical-align:middle;position:relative;display:inline-block;margin:0 5px 0 0;width:40px;height:20px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-checkbox-toggle .wp-mail-smtp-setting-field .wp-mail-smtp-setting-toggle-switch:before{position:absolute;content:"";height:14px;width:14px;left:3px;top:3px;background-color:#fff;border-radius:50%;-webkit-transition:all 0.2s ease-in-out;-moz-transition:all 0.2s ease-in-out;-ms-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer{padding-bottom:20px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailers{width:680px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer{display:inline-block;width:150px;margin-right:15px;margin-bottom:15px;position:relative}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer .wp-mail-smtp-mailer-recommended{position:absolute;right:-1px;width:99px;top:2px;z-index:1}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer:last-child{margin-right:0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer .wp-mail-smtp-mailer-image{background:#fff;text-align:center;border:2px solid #E5E5E5;border-radius:4px;cursor:pointer;height:76px;position:relative;margin-bottom:10px;-webkit-transition:all 0.2s ease-in-out;-moz-transition:all 0.2s ease-in-out;-ms-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer .wp-mail-smtp-mailer-image.is-recommended{background-image:url(../images/recommended.svg);background-repeat:no-repeat;background-size:60%;background-position:top right -2px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer .wp-mail-smtp-mailer-image img{max-width:90%;max-height:40px;display:block;position:relative;top:50%;left:50%;transform:translate(-50%, -50%);opacity:0.6;-webkit-transition:all 0.2s ease-in-out;-moz-transition:all 0.2s ease-in-out;-ms-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer.wp-mail-smtp-mailer-smtp .wp-mail-smtp-mailer-image img{max-height:30px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer.active .wp-mail-smtp-mailer-image{border-color:#FF982D}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer.active .wp-mail-smtp-mailer-image img{opacity:1}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer:hover .wp-mail-smtp-mailer-image{border-color:#ccc}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row.wp-mail-smtp-setting-row-mailer .wp-mail-smtp-mailer:hover .wp-mail-smtp-mailer-image img{opacity:1}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row h2,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row h4{color:#444;font-size:20px;font-weight:700;margin:0 0 6px 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row h2{margin-bottom:15px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row h3{color:#444;font-size:24px;font-weight:600;margin:0 0 20px 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p{margin:12px 0 0;font-size:14px;line-height:1.5em}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p:first-of-type{margin:8px 0 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p.desc{font-style:italic;color:#777}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p.buttonned{margin-top:30px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p.inline-notice{margin:5px 0 15px;box-sizing:border-box;background:#fff;border-left:4px solid transparent;box-shadow:0 1px 1px 0 rgba(0,0,0,0.1)}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p.inline-notice.inline-error{border-color:#dc3232;margin-bottom:5px;padding:10px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p.inline-notice.inline-edu-notice{border-color:#809EB0;line-height:1.5em;padding:10px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p.inline-notice a.wp-mail-smtp-mailer-notice-dismiss{float:right;color:#999DA1;margin:0 0 10px 10px;text-decoration:none}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row p.inline-notice a.wp-mail-smtp-mailer-notice-dismiss:hover{color:#666a6e}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row ul{margin:8px 0 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row ul.list li{margin-left:20px;list-style-type:disc}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list th{padding:5px 5px 5px 0;text-align:left}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.email{padding-right:2em}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.status{width:100px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.actions a{border-bottom:1px solid;display:inline-block;margin-right:5px;text-decoration:none}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.actions a[class*=delete]{color:#a00}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.actions a[class*=delete]:hover,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.actions a[class*=delete]:active,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row table.actions-list td.actions a[class*=delete]:focus{color:#400}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=text],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=email],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=number],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=password]{background-color:#fff;border:1px solid #ddd;border-radius:3px;box-shadow:none;color:#333;display:inline-block;vertical-align:middle;padding:7px 12px;margin:0 10px 0 0;width:400px;min-height:35px}@media (max-width: 959px){#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=text],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=email],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=number],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=password]{width:300px}}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=text][readonly],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=email][readonly],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=number][readonly],#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=password][readonly]{background-color:#f9f9f9}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=text].small-text,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=email].small-text,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=number].small-text,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=password].small-text{width:75px}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=text]:focus,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=email]:focus,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=number]:focus,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=password]:focus{border-color:#bbb}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=text]:disabled,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=email]:disabled,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=number]:disabled,#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-row input[type=password]:disabled{opacity:0.6}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-label{display:block;float:left;width:205px;padding:0 20px 0 0}@media (max-width: 781px){#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-label{float:none;width:100%;padding-bottom:15px}}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-label label{display:block;font-weight:600;font-size:1.1em}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-field{display:block;margin:0 0 0 205px;max-width:800px}@media (max-width: 781px){#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-setting-field{margin:0}}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-submit{margin:0;padding:25px 0}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-submit .help-text{margin-left:10px;vertical-align:middle}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-mailer-options .wp-mail-smtp-mailer-option .wp-mail-smtp-setting-row.section-heading{padding:20px 0 !important}#wp-mail-smtp .wp-mail-smtp-page-content .wp-mail-smtp-mailer-options .wp-mail-smtp-mailer-option blockquote{background:#E5E5E5;border-radius:4px;color:#666;font-size:14px;margin:20px 0;padding:15px;width:1005px}#wp-mail-smtp .wp-mail-smtp-page-content.wp-mail-smtp-page-general p{margin:0}#wp-mail-smtp .wp-mail-smtp-page-content .notice-inline{background:#fff;border-left:4px solid #fff;box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);margin:5px 0 15px;padding:1px 12px}#wp-mail-smtp .wp-mail-smtp-page-content .notice-inline.notice-success{border-left-color:#46b450}#wp-mail-smtp .wp-mail-smtp-page-content .notice-inline.notice-warning{border-left-color:#ffb900}#wp-mail-smtp .wp-mail-smtp-page-content .notice-inline.notice-error{border-left-color:#dc3232}#wp-mail-smtp .wp-mail-smtp-page-content .notice-inline.notice-info{border-left-color:#00a0d2}#wp-mail-smtp .wp-mail-smtp-page-content .notice p,#wp-mail-smtp .wp-mail-smtp-page-content .notice-inline p{margin:0.5em 0;padding:2px}#wp-mail-smtp .wp-mail-smtp-page-content pre{white-space:pre-line}#wp-mail-smtp .wp-mail-smtp-page-content.active{display:block}#wp-mail-smtp .wp-mail-smtp-page-content .connected-as{margin-left:30px}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug{background-color:#fff;padding:25px 20px 1px 25px}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug h2{color:#444;margin:1.4em 0 0.8em;font-size:16px;font-weight:700}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug p{font-size:14px;color:#555;margin-bottom:1.1em}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ul,#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ol{font-size:14px;color:#555;margin:0 0 1.1em 1.8em}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ul li,#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ol li{margin:0 0 8px 0;line-height:1.5}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ul li:last-of-type,#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ol li:last-of-type{margin:0}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ul li ul,#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug ol li ul{list-style-type:disc}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug a{color:#FF982D}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug a:hover{color:#f97f00}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .dashicons-star-filled{color:#FF982D;width:16px;height:16px;font-size:16px;vertical-align:text-top}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .price-off{color:green;font-weight:bold}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .error-log-toggle{text-decoration:none;color:#444}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .error-log-toggle:hover{color:#FF982D}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .error-log-toggle .dashicons{font-size:15px;height:15px;width:15px;padding-top:3px;border:0;outline:0}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .error-log{border-left:3px solid #ffb900;padding:0 0 0 20px;margin:0 0 10px 0;font-size:12px;display:none}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .error-log pre{margin:0}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-debug .error-log-note{display:none}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner{background-color:#fff;padding:25px 20px;border:1px solid #dadada;margin:10px 0 0 0;position:relative}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .wp-mail-smtp-pro-banner-dismiss{position:absolute;right:10px;top:10px}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .wp-mail-smtp-pro-banner-dismiss button{background:none;border:none;color:#a9a9a9;cursor:pointer;margin:0;padding:0}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner h2{color:#444;margin-top:0;font-size:16px;font-weight:700}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner p{font-size:14px;color:#555;margin-bottom:1.1em}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner p:last-of-type{margin:0}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .benefits{margin:0 0 16px 0;overflow:auto;max-width:1000px}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .benefits ul{margin:0;padding:0;width:50%;float:left}@media (max-width: 600px){#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .benefits ul{width:100%;float:none}}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .benefits ul li{margin:0;padding:0 0 2px 16px;color:#555;font-size:14px;position:relative}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .benefits ul li:before{content:'+';position:absolute;top:-1px;left:0}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .benefits ul li.arrow-right:before{content:'→'}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner a{color:#FF982D}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner a:hover,#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner a:active,#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner a:focus{color:#f97f00}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .stars{text-decoration:none}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .stars .dashicons{width:16px;height:16px;font-size:16px;vertical-align:text-top}#wp-mail-smtp .wp-mail-smtp-page-content #wp-mail-smtp-pro-banner .price-off{color:green;font-weight:bold}#wp-mail-smtp .wp-mail-smtp-admin-columns>div[class*="-column-"]{float:left}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-20{width:20%}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-33{width:33.33333%}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-40{width:40%}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-50{width:50%}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-60{width:60%}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-80{width:80%}#wp-mail-smtp .wp-mail-smtp-admin-columns .wp-mail-smtp-admin-column-last{float:right !important}#wp-mail-smtp .wp-mail-smtp-admin-columns:after{content:"";display:table;clear:both}#wp-mail-smtp .wp-mail-smtp-page-upsell{display:flex;align-items:center;justify-content:center;height:auto;flex-direction:column}#wp-mail-smtp .wp-mail-smtp-page-upsell>*{width:800px}#wp-mail-smtp .wp-mail-smtp-page-upsell *,#wp-mail-smtp .wp-mail-smtp-page-upsell *::before,#wp-mail-smtp .wp-mail-smtp-page-upsell *::after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#wp-mail-smtp .wp-mail-smtp-page-upsell h2{font-size:24px;color:#444444;text-align:center}#wp-mail-smtp .wp-mail-smtp-page-upsell h3{font-size:16px;font-weight:normal;color:#72777C;line-height:1.5em;margin-top:0;margin-bottom:25px;text-align:center}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-content .wp-mail-smtp-page-upsell-features{margin-bottom:40px;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;align-items:stretch;align-content:flex-start}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-content .wp-mail-smtp-page-upsell-features .wp-mail-smtp-page-upsell-feature{display:flex;flex-direction:row;width:360px;align-items:flex-start;align-content:flex-start;margin-right:60px;margin-top:40px}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-content .wp-mail-smtp-page-upsell-features .wp-mail-smtp-page-upsell-feature:nth-of-type(1){margin-top:20px}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-content .wp-mail-smtp-page-upsell-features .wp-mail-smtp-page-upsell-feature:nth-of-type(2){margin-top:20px}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-content .wp-mail-smtp-page-upsell-features .wp-mail-smtp-page-upsell-feature:nth-of-type(even){margin-right:0}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-content .wp-mail-smtp-page-upsell-features .wp-mail-smtp-page-upsell-feature .wp-mail-smtp-page-upsell-feature-image{width:65px;text-align:center}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-content .wp-mail-smtp-page-upsell-features .wp-mail-smtp-page-upsell-feature .wp-mail-smtp-page-upsell-feature-image img{display:block;margin:5px auto 0}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-content .wp-mail-smtp-page-upsell-features .wp-mail-smtp-page-upsell-feature .wp-mail-smtp-page-upsell-feature-content{margin-left:20px}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-content .wp-mail-smtp-page-upsell-features .wp-mail-smtp-page-upsell-feature .wp-mail-smtp-page-upsell-feature-content h4{font-size:15px;margin:0 0 0.5em}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-content .wp-mail-smtp-page-upsell-features .wp-mail-smtp-page-upsell-feature .wp-mail-smtp-page-upsell-feature-content p{color:#72777C;margin:0}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-images{margin-bottom:20px;text-align:center}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-images img{width:380px;height:auto;margin-right:20px;border:5px solid #fff;border-radius:5px;box-shadow:0 0 10px 5px rgba(0,0,0,0.15)}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-images img:last-child{margin-right:0}#wp-mail-smtp .wp-mail-smtp-page-upsell .wp-mail-smtp-page-upsell-button{text-align:center}.wp-mail-smtp-btn{border:0;border-radius:3px;cursor:pointer;display:inline-block;margin:0;text-decoration:none;text-align:center;vertical-align:middle;white-space:nowrap;text-shadow:none;box-shadow:none;outline:none}.wp-mail-smtp-btn .dashicons{font-size:16px;width:16px;height:16px}.wp-mail-smtp-btn:disabled{opacity:0.5;cursor:not-allowed}.wp-mail-smtp-btn.wp-mail-smtp-btn-md{font-size:13px;font-weight:600;padding:8px 12px;min-height:35px}.wp-mail-smtp-btn.wp-mail-smtp-btn-lg{font-size:16px;font-weight:600;padding:16px 28px}.wp-mail-smtp-btn.wp-mail-smtp-btn-orange{background-color:#FF982D;border-color:#FF982D;color:#fff}.wp-mail-smtp-btn.wp-mail-smtp-btn-orange:hover,.wp-mail-smtp-btn.wp-mail-smtp-btn-orange:active,.wp-mail-smtp-btn.wp-mail-smtp-btn-orange:focus{background-color:#f97f00;border-color:#f97f00}.wp-mail-smtp-btn.wp-mail-smtp-btn-red{background-color:#DC3232;border-color:#DC3232;color:#fff}.wp-mail-smtp-btn.wp-mail-smtp-btn-red:hover,.wp-mail-smtp-btn.wp-mail-smtp-btn-red:active,.wp-mail-smtp-btn.wp-mail-smtp-btn-red:focus{background-color:darkred;border-color:darkred}.wp-mail-smtp-btn.wp-mail-smtp-btn-grey{background-color:#f5f5f5;border:1px solid #ccc;color:#666}.wp-mail-smtp-btn.wp-mail-smtp-btn-grey:hover,.wp-mail-smtp-btn.wp-mail-smtp-btn-grey:active,.wp-mail-smtp-btn.wp-mail-smtp-btn-grey:focus{background-color:#d7d7d7;border-color:#ccc;color:#444}.wp-mail-smtp-btn.wp-mail-smtp-btn-light-grey{background-color:#f5f5f5;border:1px solid #ccc;color:#666}.wp-mail-smtp-btn.wp-mail-smtp-btn-light-grey:hover,.wp-mail-smtp-btn.wp-mail-smtp-btn-light-grey:active,.wp-mail-smtp-btn.wp-mail-smtp-btn-light-grey:focus{background-color:#eee;color:#444}.wp-mail-smtp-btn.wp-mail-smtp-btn-blueish{background-color:#738e9e;border:1px solid #738e9e;color:#fff}.wp-mail-smtp-btn.wp-mail-smtp-btn-blueish:hover,.wp-mail-smtp-btn.wp-mail-smtp-btn-blueish:active,.wp-mail-smtp-btn.wp-mail-smtp-btn-blueish:focus{background-color:#395360;border-color:#395360;color:#fff}
2
 
3
  /*# sourceMappingURL=smtp-admin.min.css.map */
assets/css/smtp-logs.min.css DELETED
@@ -1,3 +0,0 @@
1
- .wp-mail-smtp-page-logs .wp-mail-smtp-logs-upsell{text-align:center;width:730px;box-shadow:0 0 60px 30px rgba(0,0,0,0.15);border-radius:3px;position:absolute;top:75px;left:50%;margin:0 auto 0 -365px;z-index:100}.wp-mail-smtp-page-logs .wp-mail-smtp-logs-upsell *,.wp-mail-smtp-page-logs .wp-mail-smtp-logs-upsell *::before,.wp-mail-smtp-page-logs .wp-mail-smtp-logs-upsell *::after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wp-mail-smtp-page-logs .wp-mail-smtp-logs-upsell .wp-mail-smtp-logs-upsell-content{background-color:#fff;border-radius:3px 3px 0 0;padding:40px}.wp-mail-smtp-page-logs .wp-mail-smtp-logs-upsell .wp-mail-smtp-logs-upsell-content h2{font-size:20px;margin:0 0 16px 0;padding:0}.wp-mail-smtp-page-logs .wp-mail-smtp-logs-upsell .wp-mail-smtp-logs-upsell-content p{font-size:16px;color:#666;margin:0 0 30px 0;padding:0}.wp-mail-smtp-page-logs .wp-mail-smtp-logs-upsell .wp-mail-smtp-logs-upsell-content ul{float:left;width:50%;margin:0;padding:0 0 0 30px;text-align:left}.wp-mail-smtp-page-logs .wp-mail-smtp-logs-upsell .wp-mail-smtp-logs-upsell-content ul li{color:#666;font-size:16px;padding:6px 0}.wp-mail-smtp-page-logs .wp-mail-smtp-logs-upsell .wp-mail-smtp-logs-upsell-content ul li .dashicons-yes{color:#2a9b39}.wp-mail-smtp-page-logs .wp-mail-smtp-logs-upsell .wp-mail-smtp-logs-upsell-button{border-radius:0 0 3px 3px;padding:30px;background:#f5f5f5;text-align:center}
2
-
3
- /*# sourceMappingURL=smtp-logs.min.css.map */
 
 
 
assets/images/control/admin.png ADDED
Binary file
assets/images/control/comments.png ADDED
Binary file
assets/images/control/personal.png ADDED
Binary file
assets/images/control/update.png ADDED
Binary file
assets/images/control/user_new.png ADDED
Binary file
assets/images/control/users.png ADDED
Binary file
assets/images/logs/archive.png ADDED
Binary file
assets/images/logs/single.png ADDED
Binary file
assets/images/recommended.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg id="recommended_-_orange_overlay" data-name="recommended - orange overlay" xmlns="http://www.w3.org/2000/svg" width="159" height="22"><defs><style>.cls-2{fill:#fff;fill-rule:evenodd}</style></defs><path id="reocmmended_bg" data-name="reocmmended bg" d="M0 0h155a4 4 0 0 1 4 4v18H4a4 4 0 0 1-4-4V0z" fill="#fb963c"/><path id="recommended" class="cls-2" d="M1524.28 1519.89a3.713 3.713 0 0 1 2.55.8 2.721 2.721 0 0 1 .92 2.19 3.405 3.405 0 0 1-.47 1.82 2.434 2.434 0 0 1-1.51 1.08v.03a1.994 1.994 0 0 1 .81.32 1.891 1.891 0 0 1 .49.53 2.042 2.042 0 0 1 .27.7 6.668 6.668 0 0 1 .14.8c.02.28.04.56.05.85a7.893 7.893 0 0 0 .08.85 5.045 5.045 0 0 0 .18.79 1.922 1.922 0 0 0 .36.66h-1.69a.973.973 0 0 1-.22-.48 4.45 4.45 0 0 1-.07-.68q-.015-.375-.03-.81a5.839 5.839 0 0 0-.1-.84c-.04-.28-.1-.55-.16-.8a1.693 1.693 0 0 0-.3-.65 1.437 1.437 0 0 0-.55-.45 2.013 2.013 0 0 0-.89-.17h-3.72v4.88h-1.52v-11.42h5.38zm.32 5.18a2.22 2.22 0 0 0 .84-.31 1.732 1.732 0 0 0 .58-.62 2.176 2.176 0 0 0 .21-1.02 2.043 2.043 0 0 0-.48-1.41 1.968 1.968 0 0 0-1.55-.54h-3.78v3.98h3.17a5.512 5.512 0 0 0 1.01-.08zm13.55-5.18v1.28h-6.37v3.63h5.94v1.28h-5.94v3.95h6.42v1.28h-7.94v-11.42h7.89zm9.19 1.61a3.555 3.555 0 0 0-2.07-.6 3.676 3.676 0 0 0-1.75.38 3.618 3.618 0 0 0-1.2 1.03 4.6 4.6 0 0 0-.7 1.48 7.07 7.07 0 0 0-.22 1.73 7.879 7.879 0 0 0 .22 1.85 4.521 4.521 0 0 0 .7 1.52 3.557 3.557 0 0 0 1.21 1.03 3.717 3.717 0 0 0 1.76.38 3.431 3.431 0 0 0 1.33-.24 3.08 3.08 0 0 0 1.68-1.74 4.308 4.308 0 0 0 .28-1.31h1.52a5.151 5.151 0 0 1-1.48 3.36 4.839 4.839 0 0 1-3.46 1.2 5.428 5.428 0 0 1-2.32-.46 4.576 4.576 0 0 1-1.65-1.25 5.658 5.658 0 0 1-.98-1.89 8.07 8.07 0 0 1-.33-2.34 7.745 7.745 0 0 1 .35-2.34 5.756 5.756 0 0 1 1.03-1.91 4.743 4.743 0 0 1 1.7-1.29 5.389 5.389 0 0 1 2.33-.47 5.8 5.8 0 0 1 1.69.24 4.54 4.54 0 0 1 1.43.7 4.145 4.145 0 0 1 1.04 1.16 4.09 4.09 0 0 1 .54 1.61h-1.52a2.819 2.819 0 0 0-1.13-1.83zm6.16 5.8a4.694 4.694 0 0 0 .7 1.52 3.781 3.781 0 0 0 1.23 1.08 4.228 4.228 0 0 0 3.59 0 3.781 3.781 0 0 0 1.23-1.08 4.694 4.694 0 0 0 .7-1.52 6.4 6.4 0 0 0 0-3.4 4.694 4.694 0 0 0-.7-1.52 3.781 3.781 0 0 0-1.23-1.08 4.228 4.228 0 0 0-3.59 0 3.781 3.781 0 0 0-1.23 1.08 4.694 4.694 0 0 0-.7 1.52 6.4 6.4 0 0 0 0 3.4zm-1.4-3.95a5.6 5.6 0 0 1 1.03-1.91 5.124 5.124 0 0 1 1.71-1.33 6.049 6.049 0 0 1 4.77 0 5.124 5.124 0 0 1 1.71 1.33 5.6 5.6 0 0 1 1.03 1.91 7.407 7.407 0 0 1 0 4.5 5.6 5.6 0 0 1-1.03 1.91 5.1 5.1 0 0 1-1.71 1.32 6.049 6.049 0 0 1-4.77 0 5.1 5.1 0 0 1-1.71-1.32 5.6 5.6 0 0 1-1.03-1.91 7.407 7.407 0 0 1 0-4.5zm14.96-3.46l3.6 9.6 3.62-9.6h2.08v11.42h-1.44v-9.5h-.03l-3.57 9.5h-1.3l-3.56-9.5h-.04v9.5h-1.44v-11.42h2.08zm14.34 0l3.6 9.6 3.62-9.6h2.08v11.42h-1.44v-9.5h-.04l-3.56 9.5h-1.3l-3.57-9.5h-.03v9.5h-1.44v-11.42h2.08zm20.11 0v1.28h-6.37v3.63h5.94v1.28h-5.94v3.95h6.42v1.28h-7.94v-11.42h7.89zm3.89 0l6.02 9.26h.03v-9.26h1.44v11.42h-1.67l-5.96-9.17h-.04v9.17h-1.44v-11.42h1.62zm14.4 10.14a5.574 5.574 0 0 0 .64-.04 3.326 3.326 0 0 0 .82-.19 3.832 3.832 0 0 0 .85-.44 2.832 2.832 0 0 0 .76-.78 4.181 4.181 0 0 0 .55-1.24 6.328 6.328 0 0 0 .22-1.8 7.855 7.855 0 0 0-.2-1.84 3.432 3.432 0 0 0-.66-1.37 2.86 2.86 0 0 0-1.17-.87 4.839 4.839 0 0 0-1.78-.29h-2.56v8.86h2.53zm-.13-10.14a5.738 5.738 0 0 1 4.07 1.34 5.385 5.385 0 0 1 1.42 4.1 9.354 9.354 0 0 1-.32 2.55 4.655 4.655 0 0 1-.99 1.87 4.228 4.228 0 0 1-1.71 1.16 6.842 6.842 0 0 1-2.47.4h-3.92v-11.42h3.92zm15.63 0v1.28h-6.36v3.63h5.93v1.28h-5.93v3.95h6.41v1.28h-7.93v-11.42h7.88zm6.34 10.14a5.574 5.574 0 0 0 .64-.04 3.326 3.326 0 0 0 .82-.19 3.832 3.832 0 0 0 .85-.44 2.832 2.832 0 0 0 .76-.78 4.181 4.181 0 0 0 .55-1.24 6.328 6.328 0 0 0 .22-1.8 7.855 7.855 0 0 0-.2-1.84 3.432 3.432 0 0 0-.66-1.37 2.86 2.86 0 0 0-1.17-.87 4.839 4.839 0 0 0-1.78-.29h-2.56v8.86h2.53zm-.13-10.14a5.738 5.738 0 0 1 4.07 1.34 5.385 5.385 0 0 1 1.42 4.1 9.354 9.354 0 0 1-.32 2.55 4.655 4.655 0 0 1-.99 1.87 4.228 4.228 0 0 1-1.71 1.16 6.842 6.842 0 0 1-2.47.4h-3.92v-11.42h3.92z" transform="translate(-1493 -1514)"/><path id="star" class="cls-2" d="M1504.56 1518.67l-1.78 3.62-4 .58a.872.872 0 0 0-.48 1.49l2.89 2.82-.69 3.98a.875.875 0 0 0 1.27.92l3.58-1.88 3.57 1.88a.877.877 0 0 0 1.27-.92l-.69-3.98 2.89-2.82a.872.872 0 0 0-.48-1.49l-3.99-.58-1.79-3.62a.876.876 0 0 0-1.57 0z" transform="translate(-1493 -1514)"/></svg>
assets/images/sendinblue.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 713 103"><path d="M150.3 32.9c-7.2 0-11.9 2.4-11.9 6.6s4.9 6.1 12.1 6.9c10.3.9 23.7 2.6 23.7 16.6 0 9.9-9.4 17-23.8 17-9.1 0-17.8-2-25.5-9.9l6.1-7.9c5.1 5.1 12 8 19.2 7.9 6.2 0 12.3-1.9 12.3-6.9s-4.8-6.7-13-7.4c-10.4-.9-22.8-4-22.8-15.9s12.8-16.4 23.2-16.4c7.8-.2 15.3 2.3 21.5 7.1l-6.1 7.1c-4.2-3.3-9.5-5-15-4.8zm62.5 36.6c5.9 0 12.7-2 16.2-5.8l7.6 7.1c-5.8 6.2-15.4 9.2-24 9.2-18.3 0-30.1-11-30.1-28.2 0-16.4 12.2-28.2 29.9-28.2 16.4 0 27.7 9.3 27.7 27.8 0 1.5-.1 3.2-.2 4.8h-45.2c.9 8.3 7.8 13.3 18.1 13.3zm-.4-36c-8.5 0-15.8 4.5-17.6 13.2h33.9c-.8-8.6-6.6-13.2-16.3-13.2zm81.7 15c0-9.3-5.4-14.6-15.1-14.6-4.2 0-8.3 1.7-11.3 4.8-3 3.1-4.5 7.3-4.4 11.6v28.5h-11.7v-54h10.7l.7 7.5c4.7-5.6 11.5-8.9 18.8-8.8 13.5 0 24 8.1 24 24.9v30.3H294l.1-30.2zM377 78.7h-11l-.7-8.5c-4.4 6.4-11.7 10.1-19.3 9.8-16.2 0-28.5-10.4-28.5-28.2 0-18.3 12.1-28.2 28.3-28.2 6.8 0 16 3.2 19.6 9.6V2.5h11.7l-.1 76.2zm-47.9-27c0 10.9 7.7 17.8 17.6 17.8 9.6 0 17.5-7.9 17.5-17.7s-7.8-17.7-17.5-17.7c-9.9 0-17.6 6.7-17.6 17.6zM398.7 1c1.9-.2 3.7.5 5.1 1.8S406 6 406 7.9c-.3 3.9-3.4 6.8-7.2 6.8s-7-3-7.2-6.8c0-1.9.7-3.8 2.1-5.1s3.2-1.9 5-1.8zm5.8 77.7h-11.7V24.8h11.7v53.9zm58.2-30.2c0-9.3-5.4-14.6-15.1-14.6-4.2 0-8.3 1.7-11.3 4.8-3 3.1-4.5 7.3-4.4 11.6v28.5h-11.7v-54h10.6l.7 7.5c4.7-5.6 11.6-8.9 18.8-8.8 13.5 0 24 8.1 24 24.9v30.3h-11.7l.1-30.2zm38.4-14.9c3.6-6.4 12.8-10.1 19.6-10.1 16.1 0 28.3 9.9 28.3 28.2 0 17.9-13.1 28.2-28.4 28.2-7 0-15.1-2.9-19.5-9.8l-.7 8.5h-11V2.5h11.7v31.1zm.7 18.1c-.1 4.8 1.8 9.4 5.2 12.8 3.4 3.4 8 5.2 12.7 5 10.2 0 17.6-6.9 17.6-17.8S529.8 34 519.7 34c-4.7-.2-9.3 1.6-12.7 5-3.4 3.4-5.3 8-5.2 12.7zm71.7 27h-11.7V2.5h11.7v76.2zm27.1-24.6c0 9.2 5.3 15.5 15.2 15.5 4.2 0 8.3-1.7 11.2-4.7 2.9-3.1 4.5-7.2 4.3-11.5V24.8H643v53.9h-10.5l-.7-7.4c-4.8 5.8-11.9 9-19.2 8.7-13.7 0-23.5-9.5-23.5-25.7V24.8h11.7l-.2 29.3zm85.1 15.4c5.9 0 12.7-2 16.2-5.8l7.6 7.1c-5.8 6.2-15.4 9.2-24 9.2-18.3 0-30.1-11-30.1-28.2 0-16.4 12.2-28.2 29.9-28.2 16.4 0 27.7 9.3 27.7 27.8 0 1.5-.1 3.2-.2 4.8h-45.3c1 8.3 7.9 13.3 18.2 13.3zm-.4-36c-8.5 0-15.9 4.5-17.6 13.2h33.8c-.7-8.6-6.6-13.2-16.2-13.2z" fill="#091e3f"/><path d="M90.8 26.3c-3.6-6.4-9.6-11-16.7-12.9-1.5-.4-3-.6-4.5-.8C64.6 5.3 56.2.9 47.2.9S29.9 5.3 24.9 12.7C16 13.5 8 18.6 3.6 26.3c-4.4 7.8-4.8 17.2-1.1 25.4C-1.2 59.8-.8 69.2 3.6 77c3.6 6.4 9.6 11 16.7 12.9 1.5.4 3 .7 4.6.8 5 7.4 13.4 11.8 22.4 11.8S64.6 98 69.7 90.6c8.9-.8 16.8-5.9 21.2-13.6 4.5-7.8 4.9-17.2 1.1-25.4 3.7-8.1 3.2-17.5-1.2-25.3zm-6.8 4c2.2 3.8 3 8.1 2.3 12.4-1.5-1.3-3.1-2.5-4.8-3.5-6.3-3.7-13.9-4.7-21-2.8-4.3 1.1-8.3 3.3-11.6 6.3-1.2-7.7 2.4-15.3 9.2-19.3 4.3-2.5 9.4-3.2 14.2-2 5.1 1.3 9.3 4.5 11.7 8.9zM47.2 9.9c4.2 0 8.3 1.5 11.5 4.2-1.9.6-3.7 1.4-5.4 2.4-10.1 6-15.3 17.8-12.7 29.3-7.1-2.9-11.7-9.7-11.7-17.3C28.8 18.3 37 10 47.2 9.9zM10.6 30.8c2.1-3.6 5.5-6.4 9.5-8-.4 1.9-.7 3.9-.7 5.8 0 11.7 7.8 22.2 19.4 25.8-2.1 1.7-4.5 2.9-7.1 3.6-4.8 1.2-9.9.6-14.2-1.9-9.1-5.1-12.2-16.4-7-25.3h.1zM10.5 73c-2.2-3.8-3-8.1-2.3-12.4 1.5 1.3 3.1 2.5 4.8 3.5 4.2 2.4 9 3.7 13.9 3.7 2.4 0 4.8-.3 7.1-.9 4.3-1.1 8.3-3.3 11.6-6.3 1.2 7.7-2.4 15.3-9.2 19.3-4.3 2.5-9.4 3.2-14.2 2-5-1.3-9.2-4.5-11.7-8.9zm36.9 20.4c-4.2 0-8.3-1.5-11.5-4.2 1.9-.6 3.7-1.4 5.4-2.4 10.1-6 15.3-17.8 12.8-29.2 8.2 3.3 13 11.9 11.4 20.6-1.7 8.7-9.3 15.1-18.1 15.2zm34.7-20.8c-2.1 3.6-5.3 6.4-9.2 8 .4-1.9.7-3.9.7-5.9 0-11.8-7.6-22.2-18.8-25.8 2-1.7 4.4-2.9 6.9-3.6 4.7-1.2 9.6-.5 13.8 2 8.7 5.2 11.7 16.4 6.6 25.3z" fill="#0092ff"/></svg>
assets/js/smtp-admin.js CHANGED
@@ -1,79 +1,200 @@
1
- /* globals jQuery */
2
- jQuery( document ).ready( function ( $ ) {
3
-
4
- $( '.wp-mail-smtp-mailer input' ).click( function () {
5
- if ( $( this ).prop( 'disabled' ) ) {
6
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  }
 
8
 
9
- // Deselect the current mailer.
10
- $( '.wp-mail-smtp-mailer' ).removeClass( 'active' );
11
- // Select the correct one.
12
- $( this ).parents( '.wp-mail-smtp-mailer' ).addClass( 'active' );
13
-
14
- $( '.wp-mail-smtp-mailer-option' ).addClass( 'hidden' ).removeClass( 'active' );
15
- $( '.wp-mail-smtp-mailer-option-' + $( this ).val() ).addClass( 'active' ).removeClass( 'hidden' );
16
- } );
17
-
18
- $( '.wp-mail-smtp-mailer-image' ).click( function () {
19
- $( this ).parents( '.wp-mail-smtp-mailer' ).find( 'input' ).trigger( 'click' );
20
- } );
21
-
22
- $( '.wp-mail-smtp-setting-copy' ).click( function ( e ) {
23
- e.preventDefault();
24
-
25
- var target = $( '#' + $( this ).data( 'source_id' ) ).get( 0 );
26
-
27
- target.select();
28
 
29
- document.execCommand( 'Copy' );
30
- } );
31
-
32
- $( '#wp-mail-smtp-setting-smtp-auth' ).change( function () {
33
- $( '#wp-mail-smtp-setting-row-smtp-user, #wp-mail-smtp-setting-row-smtp-pass' ).toggleClass( 'inactive' );
34
- } );
35
-
36
- $( '#wp-mail-smtp-setting-row-smtp-encryption input' ).change( function () {
37
-
38
- var $this = $( this ),
39
- $smtpPort = $( '#' + 'wp-mail-smtp-setting-smtp-port' );
40
-
41
- if ( 'tls' === $this.val() ) {
42
- $smtpPort.val( '587' );
43
- $( '#wp-mail-smtp-setting-row-smtp-autotls' ).addClass( 'inactive' );
44
- } else if ( 'ssl' === $this.val() ) {
45
- $smtpPort.val( '465' );
46
- $( '#wp-mail-smtp-setting-row-smtp-autotls' ).removeClass( 'inactive' );
47
- } else {
48
- $smtpPort.val( '25' );
49
- $( '#wp-mail-smtp-setting-row-smtp-autotls' ).removeClass( 'inactive' );
50
- }
51
- } );
52
-
53
- $( '#wp-mail-smtp-pro-banner-dismiss' ).on( 'click', function () {
54
- $.ajax( {
55
- url: ajaxurl,
56
- dataType: 'json',
57
- type: 'POST',
58
- data: {
59
- action: 'wp_mail_smtp_ajax',
60
- task: 'pro_banner_dismiss'
61
- }
62
- } )
63
- .always( function () {
64
- $( '#wp-mail-smtp-pro-banner' ).fadeOut( 'fast' );
65
- } );
66
- } );
67
-
68
- $( '#wp-mail-smtp-debug .error-log-toggle' ).on( 'click', function ( e ) {
69
- e.preventDefault();
70
-
71
- $( '#wp-mail-smtp-debug .error-log-toggle' ).find( '.dashicons' ).toggleClass( 'dashicons-arrow-right-alt2 dashicons-arrow-down-alt2' );
72
- $( '#wp-mail-smtp-debug .error-log' ).slideToggle();
73
- $( '#wp-mail-smtp-debug .error-log-note' ).toggle();
74
- } );
75
-
76
- $( '.js-wp-mail-smtp-provider-remove' ).on( 'click', function () {
77
- return confirm( window.wp_mail_smtp.text_provider_remove );
78
- } );
79
- } );
1
+ /* globals jQuery, wp_mail_smtp */
2
+ var WPMailSMTP = window.WPMailSMTP || {};
3
+ WPMailSMTP.Admin = WPMailSMTP.Admin || {};
4
+
5
+ /**
6
+ * WP Mail SMTP Admin area module.
7
+ *
8
+ * @since 1.6.0
9
+ */
10
+ WPMailSMTP.Admin.Settings = WPMailSMTP.Admin.Settings || (function ( document, window, $ ) {
11
+
12
+ 'use strict';
13
+
14
+ /**
15
+ * Private functions and properties.
16
+ *
17
+ * @since 1.6.0
18
+ *
19
+ * @type {Object}
20
+ */
21
+ var __private = {};
22
+
23
+ /**
24
+ * Public functions and properties.
25
+ *
26
+ * @since 1.6.0
27
+ *
28
+ * @type {Object}
29
+ */
30
+ var app = {
31
+ /**
32
+ * Start the engine. DOM is not ready yet, use only to init something.
33
+ *
34
+ * @since 1.6.0
35
+ */
36
+ init: function () {
37
+
38
+ // Do that when DOM is ready.
39
+ $( document ).ready( app.ready );
40
+ },
41
+
42
+ /**
43
+ * DOM is fully loaded.
44
+ *
45
+ * @since 1.6.0
46
+ */
47
+ ready: function () {
48
+
49
+ app.pageHolder = $( '.wp-mail-smtp-tab-settings' );
50
+
51
+ app.bindActions();
52
+ },
53
+
54
+ /**
55
+ * Process all generic actions/events, mostly custom that were fired by our API.
56
+ *
57
+ * @since 1.6.0
58
+ */
59
+ bindActions: function () {
60
+
61
+ // Mailer selection.
62
+ $( '.wp-mail-smtp-mailer-image', app.pageHolder ).click( function () {
63
+ $( this ).parents('.wp-mail-smtp-mailer').find( 'input' ).trigger( 'click' );
64
+ } );
65
+
66
+ $( '.wp-mail-smtp-mailer input', app.pageHolder ).click( function () {
67
+ if ( $( this ).prop( 'disabled' ) ) {
68
+ return false;
69
+ }
70
+
71
+ // Deselect the current mailer.
72
+ $( '.wp-mail-smtp-mailer', app.pageHolder ).removeClass( 'active' );
73
+ // Select the correct one.
74
+ $( this ).parents( '.wp-mail-smtp-mailer' ).addClass( 'active' );
75
+
76
+ // Hide all mailers options and display for a currently clicked one.
77
+ $( '.wp-mail-smtp-mailer-option', app.pageHolder ).addClass( 'hidden' ).removeClass( 'active' );
78
+ $( '.wp-mail-smtp-mailer-option-' + $( this ).val(), app.pageHolder ).addClass( 'active' ).removeClass( 'hidden' );
79
+ } );
80
+
81
+ app.mailers.smtp.bindActions();
82
+
83
+ // Dismiss Pro banner at the bottom of the page.
84
+ $( '#wp-mail-smtp-pro-banner-dismiss', app.pageHolder ).on( 'click', function () {
85
+ $.ajax( {
86
+ url: ajaxurl,
87
+ dataType: 'json',
88
+ type: 'POST',
89
+ data: {
90
+ action: 'wp_mail_smtp_ajax',
91
+ task: 'pro_banner_dismiss',
92
+ }
93
+ } )
94
+ .always( function () {
95
+ $( '#wp-mail-smtp-pro-banner', app.pageHolder ).fadeOut( 'fast' );
96
+ } );
97
+ } );
98
+
99
+ // Dismis educational notices for certain users.
100
+ $( '.js-wp-mail-smtp-mailer-notice-dismiss', app.pageHolder ).on( 'click', function ( e ) {
101
+ e.preventDefault();
102
+
103
+ var $btn = $( this ),
104
+ $notice = $btn.parents( '.inline-notice' );
105
+
106
+ if ( $btn.hasClass( 'disabled' ) ) {
107
+ return false;
108
+ }
109
+
110
+ $.ajax( {
111
+ url: ajaxurl,
112
+ dataType: 'json',
113
+ type: 'POST',
114
+ data: {
115
+ action: 'wp_mail_smtp_ajax',
116
+ task: 'notice_dismiss',
117
+ notice: $notice.data( 'notice' ),
118
+ mailer: $notice.data( 'mailer' )
119
+ },
120
+ beforeSend: function () {
121
+ $btn.addClass( 'disabled' );
122
+ }
123
+ } )
124
+ .always( function () {
125
+ $notice.fadeOut( 'fast', function () {
126
+ $btn.removeClass( 'disabled' );
127
+ } );
128
+ } );
129
+ } );
130
+
131
+ // Show/hide debug output.
132
+ $( '#wp-mail-smtp-debug .error-log-toggle' ).on( 'click', function ( e ) {
133
+ e.preventDefault();
134
+
135
+ $( '#wp-mail-smtp-debug .error-log-toggle' ).find( '.dashicons' ).toggleClass( 'dashicons-arrow-right-alt2 dashicons-arrow-down-alt2' );
136
+ $( '#wp-mail-smtp-debug .error-log' ).slideToggle();
137
+ $( '#wp-mail-smtp-debug .error-log-note' ).toggle();
138
+ } );
139
+
140
+ // Remove mailer connection.
141
+ $( '.js-wp-mail-smtp-provider-remove', app.pageHolder ).on( 'click', function () {
142
+ return confirm( wp_mail_smtp.text_provider_remove );
143
+ } );
144
+
145
+ // Copy input text to clipboard.
146
+ $( '.wp-mail-smtp-setting-copy', app.pageHolder ).click( function ( e ) {
147
+ e.preventDefault();
148
+
149
+ var target = $( '#' + $( this ).data( 'source_id' ) ).get( 0 );
150
+
151
+ target.select();
152
+
153
+ document.execCommand( 'Copy' );
154
+ } );
155
+ },
156
+
157
+ /**
158
+ * Individual mailers specific js code.
159
+ *
160
+ * @since 1.6.0
161
+ */
162
+ mailers: {
163
+ smtp: {
164
+ bindActions: function () {
165
+
166
+ // Hide SMTP-specific user/pass when Auth disabled.
167
+ $( '#wp-mail-smtp-setting-smtp-auth' ).change( function () {
168
+ $( '#wp-mail-smtp-setting-row-smtp-user, #wp-mail-smtp-setting-row-smtp-pass' ).toggleClass( 'inactive' );
169
+ } );
170
+
171
+ // Port default values based on encryption type.
172
+ $( '#wp-mail-smtp-setting-row-smtp-encryption input' ).change( function () {
173
+
174
+ var $input = $( this ),
175
+ $smtpPort = $( '#wp-mail-smtp-setting-smtp-port', app.pageHolder );
176
+
177
+ if ( 'tls' === $input.val() ) {
178
+ $smtpPort.val( '587' );
179
+ $( '#wp-mail-smtp-setting-row-smtp-autotls' ).addClass( 'inactive' );
180
+ }
181
+ else if ( 'ssl' === $input.val() ) {
182
+ $smtpPort.val( '465' );
183
+ $( '#wp-mail-smtp-setting-row-smtp-autotls' ).removeClass( 'inactive' );
184
+ }
185
+ else {
186
+ $smtpPort.val( '25' );
187
+ $( '#wp-mail-smtp-setting-row-smtp-autotls' ).removeClass( 'inactive' );
188
+ }
189
+ } );
190
+ }
191
+ }
192
  }
193
+ };
194
 
195
+ // Provide access to public functions/properties.
196
+ return app;
197
+ })( document, window, jQuery );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
 
199
+ // Initialize.
200
+ WPMailSMTP.Admin.Settings.init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/smtp-admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(i){i(".wp-mail-smtp-mailer input").click(function(){if(i(this).prop("disabled"))return!1;i(".wp-mail-smtp-mailer").removeClass("active"),i(this).parents(".wp-mail-smtp-mailer").addClass("active"),i(".wp-mail-smtp-mailer-option").addClass("hidden").removeClass("active"),i(".wp-mail-smtp-mailer-option-"+i(this).val()).addClass("active").removeClass("hidden")}),i(".wp-mail-smtp-mailer-image").click(function(){i(this).parents(".wp-mail-smtp-mailer").find("input").trigger("click")}),i(".wp-mail-smtp-setting-copy").click(function(t){t.preventDefault(),i("#"+i(this).data("source_id")).get(0).select(),document.execCommand("Copy")}),i("#wp-mail-smtp-setting-smtp-auth").change(function(){i("#wp-mail-smtp-setting-row-smtp-user, #wp-mail-smtp-setting-row-smtp-pass").toggleClass("inactive")}),i("#wp-mail-smtp-setting-row-smtp-encryption input").change(function(){var t=i(this),a=i("#wp-mail-smtp-setting-smtp-port");"tls"===t.val()?(a.val("587"),i("#wp-mail-smtp-setting-row-smtp-autotls").addClass("inactive")):("ssl"===t.val()?a.val("465"):a.val("25"),i("#wp-mail-smtp-setting-row-smtp-autotls").removeClass("inactive"))}),i("#wp-mail-smtp-pro-banner-dismiss").on("click",function(){i.ajax({url:ajaxurl,dataType:"json",type:"POST",data:{action:"wp_mail_smtp_ajax",task:"pro_banner_dismiss"}}).always(function(){i("#wp-mail-smtp-pro-banner").fadeOut("fast")})}),i("#wp-mail-smtp-debug .error-log-toggle").on("click",function(t){t.preventDefault(),i("#wp-mail-smtp-debug .error-log-toggle").find(".dashicons").toggleClass("dashicons-arrow-right-alt2 dashicons-arrow-down-alt2"),i("#wp-mail-smtp-debug .error-log").slideToggle(),i("#wp-mail-smtp-debug .error-log-note").toggle()}),i(".js-wp-mail-smtp-provider-remove").on("click",function(){return confirm(window.wp_mail_smtp.text_provider_remove)})});
1
+ var WPMailSMTP=window.WPMailSMTP||{};WPMailSMTP.Admin=WPMailSMTP.Admin||{},WPMailSMTP.Admin.Settings=WPMailSMTP.Admin.Settings||function(a,i,e){"use strict";var t={init:function(){e(a).ready(t.ready)},ready:function(){t.pageHolder=e(".wp-mail-smtp-tab-settings"),t.bindActions()},bindActions:function(){e(".wp-mail-smtp-mailer-image",t.pageHolder).click(function(){e(this).parents(".wp-mail-smtp-mailer").find("input").trigger("click")}),e(".wp-mail-smtp-mailer input",t.pageHolder).click(function(){if(e(this).prop("disabled"))return!1;e(".wp-mail-smtp-mailer",t.pageHolder).removeClass("active"),e(this).parents(".wp-mail-smtp-mailer").addClass("active"),e(".wp-mail-smtp-mailer-option",t.pageHolder).addClass("hidden").removeClass("active"),e(".wp-mail-smtp-mailer-option-"+e(this).val(),t.pageHolder).addClass("active").removeClass("hidden")}),t.mailers.smtp.bindActions(),e("#wp-mail-smtp-pro-banner-dismiss",t.pageHolder).on("click",function(){e.ajax({url:ajaxurl,dataType:"json",type:"POST",data:{action:"wp_mail_smtp_ajax",task:"pro_banner_dismiss"}}).always(function(){e("#wp-mail-smtp-pro-banner",t.pageHolder).fadeOut("fast")})}),e(".js-wp-mail-smtp-mailer-notice-dismiss",t.pageHolder).on("click",function(i){i.preventDefault();var a=e(this),t=a.parents(".inline-notice");if(a.hasClass("disabled"))return!1;e.ajax({url:ajaxurl,dataType:"json",type:"POST",data:{action:"wp_mail_smtp_ajax",task:"notice_dismiss",notice:t.data("notice"),mailer:t.data("mailer")},beforeSend:function(){a.addClass("disabled")}}).always(function(){t.fadeOut("fast",function(){a.removeClass("disabled")})})}),e("#wp-mail-smtp-debug .error-log-toggle").on("click",function(i){i.preventDefault(),e("#wp-mail-smtp-debug .error-log-toggle").find(".dashicons").toggleClass("dashicons-arrow-right-alt2 dashicons-arrow-down-alt2"),e("#wp-mail-smtp-debug .error-log").slideToggle(),e("#wp-mail-smtp-debug .error-log-note").toggle()}),e(".js-wp-mail-smtp-provider-remove",t.pageHolder).on("click",function(){return confirm(wp_mail_smtp.text_provider_remove)}),e(".wp-mail-smtp-setting-copy",t.pageHolder).click(function(i){i.preventDefault(),e("#"+e(this).data("source_id")).get(0).select(),a.execCommand("Copy")})},mailers:{smtp:{bindActions:function(){e("#wp-mail-smtp-setting-smtp-auth").change(function(){e("#wp-mail-smtp-setting-row-smtp-user, #wp-mail-smtp-setting-row-smtp-pass").toggleClass("inactive")}),e("#wp-mail-smtp-setting-row-smtp-encryption input").change(function(){var i=e(this),a=e("#wp-mail-smtp-setting-smtp-port",t.pageHolder);"tls"===i.val()?(a.val("587"),e("#wp-mail-smtp-setting-row-smtp-autotls").addClass("inactive")):("ssl"===i.val()?a.val("465"):a.val("25"),e("#wp-mail-smtp-setting-row-smtp-autotls").removeClass("inactive"))})}}}};return t}(document,window,jQuery),WPMailSMTP.Admin.Settings.init();
assets/languages/wp-mail-smtp.pot CHANGED
@@ -1,13 +1,13 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: WP Mail SMTP 1.5.2\n"
4
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-mail-smtp\n"
5
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
6
  "Language-Team: LANGUAGE <LL@li.org>\n"
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
9
  "Content-Transfer-Encoding: 8bit\n"
10
- "POT-Creation-Date: 2019-07-18T11:22:11+03:00\n"
11
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
  "X-Generator: WP-CLI 2.2.0\n"
13
  "X-Domain: wp-mail-smtp\n"
@@ -17,8 +17,7 @@ msgid "WP Mail SMTP Pro"
17
  msgstr ""
18
 
19
  #. Plugin URI of the plugin
20
- #. Author URI of the plugin
21
- msgid "https://wpforms.com/"
22
  msgstr ""
23
 
24
  #. Description of the plugin
@@ -29,6 +28,10 @@ msgstr ""
29
  msgid "WPForms"
30
  msgstr ""
31
 
 
 
 
 
32
  #. translators: %s - error code, returned by Google API.
33
  #: src/Admin/Area.php:112
34
  msgid "There was an error while processing the authentication request: %s. Please try again."
@@ -63,16 +66,17 @@ msgstr ""
63
 
64
  #: src/Admin/Area.php:208
65
  #: src/Admin/Area.php:209
66
- #: src/Admin/Area.php:722
67
  #: wp-mail-smtp-0.11.2.php:709
68
  msgid "Settings"
69
  msgstr ""
70
 
71
  #: src/Admin/Area.php:216
72
  #: src/Admin/Area.php:217
73
- #: src/Admin/Area.php:723
74
  #: src/Admin/Pages/About.php:615
75
  #: src/Admin/Pages/Logs.php:40
 
76
  msgid "Email Log"
77
  msgstr ""
78
 
@@ -124,10 +128,14 @@ msgstr ""
124
  msgid "Please rate <strong>WP Mail SMTP</strong> <a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">&#9733;&#9733;&#9733;&#9733;&#9733;</a> on <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress.org</a> to help us spread the word. Thank you from the WP Mail SMTP team!"
125
  msgstr ""
126
 
127
- #: src/Admin/Area.php:678
128
  msgid "WP Mail SMTP Pro related message was successfully dismissed."
129
  msgstr ""
130
 
 
 
 
 
131
  #: src/Admin/PageAbstract.php:81
132
  msgid "Save Settings"
133
  msgstr ""
@@ -152,7 +160,7 @@ msgstr ""
152
 
153
  #. translators: %1$s - WPBeginner URL, %2$s - OptinMonster URL, %3$s - MonsterInsights URL.
154
  #: src/Admin/Pages/About.php:184
155
- msgid "WP Mail SMTP is brought to you by the same team that's behind the most user friendly WordPress forms, <a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">WPForms</a>, the largest WordPress resource site, <a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">WPBeginner</a>, the most popular lead-generation software, <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">OptinMonster</a>, and the best WordPress analytics plugin, <a href=\"%3$s\" target=\"_blank\" rel=\"noopener noreferrer\">MonsterInsights</a>."
156
  msgstr ""
157
 
158
  #: src/Admin/Pages/About.php:201
@@ -255,6 +263,7 @@ msgid "Bonus: WP Mail SMTP Lite users get <span class=\"price-off\">20% off regu
255
  msgstr ""
256
 
257
  #: src/Admin/Pages/About.php:616
 
258
  msgid "Email Controls"
259
  msgstr ""
260
 
@@ -298,753 +307,818 @@ msgstr ""
298
  msgid "Priority Support"
299
  msgstr ""
300
 
301
- #: src/Admin/Pages/Logs.php:71
302
- msgid "View and Manage All Sent Emails inside WordPress"
303
  msgstr ""
304
 
305
- #: src/Admin/Pages/Logs.php:75
306
- msgid "Sent emails are not stored in WP Mail SMTP Lite."
307
  msgstr ""
308
 
309
- #: src/Admin/Pages/Logs.php:76
310
- msgid "Once you upgrade to WP Mail SMTP Pro, all future sent emails will be stored in your WordPress database and displayed on this Logs screen."
311
  msgstr ""
312
 
313
- #: src/Admin/Pages/Logs.php:81
314
- msgid "View Sent Emails in Dashboard"
315
  msgstr ""
316
 
317
- #: src/Admin/Pages/Logs.php:82
318
- msgid "View Emails Sent Status"
319
  msgstr ""
320
 
321
- #: src/Admin/Pages/Logs.php:85
322
- msgid "Filter All Emails"
323
  msgstr ""
324
 
325
- #: src/Admin/Pages/Logs.php:86
326
- msgid "Search for Specific Emails"
327
  msgstr ""
328
 
329
- #: src/Admin/Pages/Logs.php:94
330
- msgid "Upgrade to WP Mail SMTP Pro Now"
331
  msgstr ""
332
 
333
- #: src/Admin/Pages/Logs.php:98
334
- msgid "and start logging all emails!"
335
  msgstr ""
336
 
337
- #: src/Admin/Pages/Misc.php:24
338
- msgid "Misc"
339
  msgstr ""
340
 
341
- #: src/Admin/Pages/Misc.php:48
342
- #: src/Admin/Pages/Settings.php:36
343
- msgid "General"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  msgstr ""
345
 
346
- #: src/Admin/Pages/Misc.php:56
 
 
 
 
347
  msgid "Do Not Send"
348
  msgstr ""
349
 
350
- #: src/Admin/Pages/Misc.php:65
351
  msgid "Check this if you would like to stop sending all emails."
352
  msgstr ""
353
 
354
- #: src/Admin/Pages/Misc.php:71
355
  msgid "Some plugins, like BuddyPress and Events Manager, are using own email delivery solutions. By default, this option does not block their emails, as those plugins do not use default <code>wp_mail()</code> function to send emails."
356
  msgstr ""
357
 
358
- #: src/Admin/Pages/Misc.php:79
359
  msgid "You will need to consult with their documentation to switch them to use default WordPress email delivery."
360
  msgstr ""
361
 
362
- #: src/Admin/Pages/Misc.php:81
363
  msgid "Test emails are allowed to be sent, regardless of this option."
364
  msgstr ""
365
 
366
- #: src/Admin/Pages/Misc.php:90
367
  #: wp-mail-smtp-0.11.2.php:346
368
  #: wp-mail-smtp-0.11.2.php:351
369
  msgid "Hide Announcements"
370
  msgstr ""
371
 
372
- #: src/Admin/Pages/Misc.php:99
373
  #: wp-mail-smtp-0.11.2.php:356
374
  msgid "Check this if you would like to hide plugin announcements and update details."
375
  msgstr ""
376
 
377
- #: src/Admin/Pages/Misc.php:108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
378
  msgid "Uninstall WP Mail SMTP"
379
  msgstr ""
380
 
381
- #: src/Admin/Pages/Misc.php:116
382
  msgid "Check this if you would like to remove ALL WP Mail SMTP data upon plugin deletion. All settings will be unrecoverable."
383
  msgstr ""
384
 
385
- #: src/Admin/Pages/Misc.php:151
386
- #: src/Admin/Pages/Settings.php:502
387
  msgid "Settings were successfully saved."
388
  msgstr ""
389
 
390
- #: src/Admin/Pages/Settings.php:64
 
 
 
 
391
  msgid "License"
392
  msgstr ""
393
 
394
- #: src/Admin/Pages/Settings.php:67
395
  msgid "Your license key provides access to updates and support."
396
  msgstr ""
397
 
398
- #: src/Admin/Pages/Settings.php:75
399
  msgid "License Key"
400
  msgstr ""
401
 
402
- #: src/Admin/Pages/Settings.php:85
403
  msgid "Mail"
404
  msgstr ""
405
 
406
- #: src/Admin/Pages/Settings.php:92
407
  #: wp-mail-smtp-0.11.2.php:247
408
  msgid "From Email"
409
  msgstr ""
410
 
411
- #: src/Admin/Pages/Settings.php:103
412
  msgid "The email address which emails are sent from."
413
  msgstr ""
414
 
415
- #: src/Admin/Pages/Settings.php:104
416
  msgid "If you using an email provider (Gmail, Yahoo, Outlook.com, etc) this should be your email address for that account."
417
  msgstr ""
418
 
419
- #: src/Admin/Pages/Settings.php:107
420
  msgid "Please note that other plugins can change this, to prevent this use the setting below."
421
  msgstr ""
422
 
423
- #: src/Admin/Pages/Settings.php:119
424
  msgid "Force From Email"
425
  msgstr ""
426
 
427
- #: src/Admin/Pages/Settings.php:124
428
  msgid "Current provider will automatically force From Email to be the email address that you use to set up the connection below."
429
  msgstr ""
430
 
431
- #: src/Admin/Pages/Settings.php:128
432
  msgid "If checked, the From Email setting above will be used for all emails, ignoring values set by other plugins."
433
  msgstr ""
434
 
435
- #: src/Admin/Pages/Settings.php:138
436
  #: wp-mail-smtp-0.11.2.php:266
437
  msgid "From Name"
438
  msgstr ""
439
 
440
- #: src/Admin/Pages/Settings.php:149
441
  msgid "The name which emails are sent from."
442
  msgstr ""
443
 
444
- #: src/Admin/Pages/Settings.php:161
445
  msgid "Force From Name"
446
  msgstr ""
447
 
448
- #: src/Admin/Pages/Settings.php:166
449
  msgid "Current provider doesn't support setting and forcing From Name. Emails will be sent on behalf of the account name used to setup the connection below."
450
  msgstr ""
451
 
452
- #: src/Admin/Pages/Settings.php:170
453
  msgid "If checked, the From Name setting above will be used for all emails, ignoring values set by other plugins."
454
  msgstr ""
455
 
456
- #: src/Admin/Pages/Settings.php:179
457
  #: wp-mail-smtp-0.11.2.php:322
458
  #: wp-mail-smtp-0.11.2.php:327
459
  msgid "Return Path"
460
  msgstr ""
461
 
462
- #: src/Admin/Pages/Settings.php:188
463
  #: wp-mail-smtp-0.11.2.php:332
464
  msgid "Set the return-path to match the From Email"
465
  msgstr ""
466
 
467
- #: src/Admin/Pages/Settings.php:192
468
  #: wp-mail-smtp-0.11.2.php:336
469
  msgid "Return Path indicates where non-delivery receipts - or bounce messages - are to be sent."
470
  msgstr ""
471
 
472
- #: src/Admin/Pages/Settings.php:193
473
  msgid "If unchecked, bounce messages may be lost. Some providers may ignore this option."
474
  msgstr ""
475
 
476
- #: src/Admin/Pages/Settings.php:201
477
  #: wp-mail-smtp-0.11.2.php:281
478
  #: wp-mail-smtp-0.11.2.php:286
479
  msgid "Mailer"
480
  msgstr ""
481
 
482
- #: src/Admin/Pages/Settings.php:276
 
 
 
 
483
  msgid "You're using WP Mail SMTP Lite - no license needed. Enjoy!"
484
  msgstr ""
485
 
486
  #. translators: %s - WPMailSMTP.com upgrade URL.
487
- #: src/Admin/Pages/Settings.php:282
488
  msgid "To unlock more features consider <strong><a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"wp-mail-smtp-upgrade-modal\">upgrading to PRO</a></strong>."
489
  msgstr ""
490
 
491
- #: src/Admin/Pages/Settings.php:301
492
  msgid "As a valued WP Mail SMTP Lite user you receive <strong>20% off</strong>, automatically applied at checkout!"
493
  msgstr ""
494
 
495
- #: src/Admin/Pages/Settings.php:362
496
  msgid "Get WP Mail SMTP Pro and Unlock all the Powerful Features"
497
  msgstr ""
498
 
499
- #: src/Admin/Pages/Settings.php:366
500
  msgid "Thanks for being a loyal WP Mail SMTP user. Upgrade to WP Mail SMTP Pro to unlock more awesome features and experience why WP Mail SMTP is the most popular SMTP plugin."
501
  msgstr ""
502
 
503
- #: src/Admin/Pages/Settings.php:370
504
  msgid "We know that you will truly love WP Mail SMTP. It's used by over 1,000,000 websites."
505
  msgstr ""
506
 
507
- #: src/Admin/Pages/Settings.php:373
508
  msgid "Pro Features:"
509
  msgstr ""
510
 
511
- #: src/Admin/Pages/Settings.php:377
512
  msgid "Manage Notifications - control which emails your site sends"
513
  msgstr ""
514
 
515
- #: src/Admin/Pages/Settings.php:378
516
  msgid "Email Logging - keep track of every email sent from your site"
517
  msgstr ""
518
 
519
- #: src/Admin/Pages/Settings.php:379
520
  msgid "Office 365 - send emails using your Office 365 account"
521
  msgstr ""
522
 
523
- #: src/Admin/Pages/Settings.php:380
524
  msgid "Amazon SES - harness the power of AWS"
525
  msgstr ""
526
 
527
- #: src/Admin/Pages/Settings.php:381
528
  msgid "Outlook.com - send emails using your Outlook.com account"
529
  msgstr ""
530
 
531
- #: src/Admin/Pages/Settings.php:382
532
  msgid "Access to our world class support team"
533
  msgstr ""
534
 
535
- #: src/Admin/Pages/Settings.php:385
536
  msgid "White Glove Setup - sit back and relax while we handle everything for you"
537
  msgstr ""
538
 
539
- #: src/Admin/Pages/Settings.php:386
540
  msgid "Install WP Mail SMTP Pro plugin"
541
  msgstr ""
542
 
543
- #: src/Admin/Pages/Settings.php:387
544
  msgid "Set up domain name verification (DNS)"
545
  msgstr ""
546
 
547
- #: src/Admin/Pages/Settings.php:388
548
  msgid "Configure Mailgun service"
549
  msgstr ""
550
 
551
- #: src/Admin/Pages/Settings.php:389
552
  msgid "Set up WP Mail SMTP Pro plugin"
553
  msgstr ""
554
 
555
- #: src/Admin/Pages/Settings.php:390
556
  msgid "Test and verify email delivery"
557
  msgstr ""
558
 
559
  #. translators: %s - WPMailSMTP.com URL.
560
- #: src/Admin/Pages/Settings.php:398
561
  msgid "<a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">Get WP Mail SMTP Pro Today and Unlock all the Powerful Features &raquo;</a>"
562
  msgstr ""
563
 
564
- #: src/Admin/Pages/Settings.php:416
565
  msgid "<strong>Bonus:</strong> WP Mail SMTP users get <span class=\"price-off\">20% off regular price</span>, automatically applied at checkout."
566
  msgstr ""
567
 
568
- #: src/Admin/Pages/Test.php:37
569
  msgid "Email Test"
570
  msgstr ""
571
 
572
- #: src/Admin/Pages/Test.php:59
573
  #: wp-mail-smtp-0.11.2.php:549
574
  msgid "Send a Test Email"
575
  msgstr ""
576
 
577
- #: src/Admin/Pages/Test.php:66
578
  msgid "Send To"
579
  msgstr ""
580
 
581
- #: src/Admin/Pages/Test.php:72
582
  msgid "Enter email address where test email will be sent."
583
  msgstr ""
584
 
585
- #: src/Admin/Pages/Test.php:80
586
  msgid "HTML"
587
  msgstr ""
588
 
589
- #: src/Admin/Pages/Test.php:86
590
- #: src/Providers/OptionsAbstract.php:204
591
- #: src/Providers/OptionsAbstract.php:226
592
  msgid "On"
593
  msgstr ""
594
 
595
- #: src/Admin/Pages/Test.php:87
596
- #: src/Providers/OptionsAbstract.php:205
597
- #: src/Providers/OptionsAbstract.php:227
598
  msgid "Off"
599
  msgstr ""
600
 
601
- #: src/Admin/Pages/Test.php:90
602
  msgid "Send this email in HTML or in plain text format."
603
  msgstr ""
604
 
605
- #: src/Admin/Pages/Test.php:105
606
  msgid "You cannot send an email. Mailer is not properly configured. Please check your settings."
607
  msgstr ""
608
 
609
- #: src/Admin/Pages/Test.php:109
610
  msgid "Send Email"
611
  msgstr ""
612
 
613
- #: src/Admin/Pages/Test.php:137
614
  msgid "Test failed. Please use a valid email address and try to resend the test email."
615
  msgstr ""
616
 
617
  #. translators: %s - email address a test email will be sent to.
618
- #: src/Admin/Pages/Test.php:149
619
- #: src/Admin/Pages/Test.php:155
620
  msgid "Test email to %s"
621
  msgstr ""
622
 
623
- #: src/Admin/Pages/Test.php:181
624
  msgid "Test plain text email was sent successfully!"
625
  msgstr ""
626
 
627
  #. translators: %s - "HTML" in bold.
628
- #: src/Admin/Pages/Test.php:185
629
  msgid "Test %s email was sent successfully! Please check your inbox to make sure it is delivered."
630
  msgstr ""
631
 
632
- #: src/Admin/Pages/Test.php:513
633
  msgid "SSL certificate issue."
634
  msgstr ""
635
 
636
- #: src/Admin/Pages/Test.php:514
637
  msgid "This means your web server cannot reliably make secure connections (make requests to HTTPS sites)."
638
  msgstr ""
639
 
640
- #: src/Admin/Pages/Test.php:515
641
- #: src/Admin/Pages/Test.php:566
642
  msgid "Typically this error is returned when web server is not configured properly."
643
  msgstr ""
644
 
645
- #: src/Admin/Pages/Test.php:518
646
  msgid "Contact your web hosting provider and inform them your site has an issue with SSL certificates."
647
  msgstr ""
648
 
649
- #: src/Admin/Pages/Test.php:519
650
- #: src/Admin/Pages/Test.php:570
651
  msgid "The exact error you can provide them is in the Error log, available at the bottom of this page."
652
  msgstr ""
653
 
654
- #: src/Admin/Pages/Test.php:520
655
- #: src/Admin/Pages/Test.php:571
656
  msgid "Ask them to resolve the issue then try again."
657
  msgstr ""
658
 
659
- #: src/Admin/Pages/Test.php:531
660
  msgid "Could not connect to host."
661
  msgstr ""
662
 
663
  #. translators: %s - SMTP host address.
664
- #: src/Admin/Pages/Test.php:535
665
- #: src/Admin/Pages/Test.php:562
666
- #: src/Admin/Pages/Test.php:635
667
  msgid "This means your web server was unable to connect to %s."
668
  msgstr ""
669
 
670
- #: src/Admin/Pages/Test.php:538
671
- #: src/Admin/Pages/Test.php:565
672
- #: src/Admin/Pages/Test.php:638
673
  msgid "This means your web server was unable to connect to the host server."
674
  msgstr ""
675
 
676
- #: src/Admin/Pages/Test.php:539
677
  msgid "Typically this error is returned your web server is blocking the connections or the SMTP host denying the request."
678
  msgstr ""
679
 
680
  #. translators: %s - SMTP host address.
681
- #: src/Admin/Pages/Test.php:544
682
  msgid "Contact your web hosting provider and ask them to verify your server can connect to %s. Additionally, ask them if a firewall or security policy may be preventing the connection."
683
  msgstr ""
684
 
685
- #: src/Admin/Pages/Test.php:547
686
  msgid "If using \"Other SMTP\" Mailer, triple check your SMTP settings including host address, email, and password."
687
  msgstr ""
688
 
689
- #: src/Admin/Pages/Test.php:548
690
  msgid "If using \"Other SMTP\" Mailer, contact your SMTP host to confirm they are accepting outside connections with the settings you have configured (address, username, port, security, etc)."
691
  msgstr ""
692
 
693
- #: src/Admin/Pages/Test.php:558
694
  msgid "Could not connect to your host."
695
  msgstr ""
696
 
697
- #: src/Admin/Pages/Test.php:569
698
  msgid "Contact your web hosting provider and inform them you are having issues making outbound connections."
699
  msgstr ""
700
 
701
- #: src/Admin/Pages/Test.php:581
702
  msgid "Could not authenticate your SMTP account."
703
  msgstr ""
704
 
705
- #: src/Admin/Pages/Test.php:582
706
  msgid "This means we were able to connect to your SMTP host, but were not able to proceed using the email/password in the settings."
707
  msgstr ""
708
 
709
- #: src/Admin/Pages/Test.php:583
710
  msgid "Typically this error is returned when the email or password is not correct or is not what the SMTP host is expecting."
711
  msgstr ""
712
 
713
- #: src/Admin/Pages/Test.php:586
714
  msgid "Triple check your SMTP settings including host address, email, and password. If you have recently reset your password you will need to update the settings."
715
  msgstr ""
716
 
717
- #: src/Admin/Pages/Test.php:587
718
- #: src/Admin/Pages/Test.php:664
719
  msgid "Contact your SMTP host to confirm you are using the correct username and password."
720
  msgstr ""
721
 
722
- #: src/Admin/Pages/Test.php:588
723
- #: src/Admin/Pages/Test.php:665
724
  msgid "Verify with your SMTP host that your account has permissions to send emails using outside connections."
725
  msgstr ""
726
 
727
- #: src/Admin/Pages/Test.php:598
728
  msgid "Error due to unsolicited and/or bulk e-mail."
729
  msgstr ""
730
 
731
- #: src/Admin/Pages/Test.php:599
732
  msgid "This means the connection to your SMTP host was made successfully, but the host rejected the email."
733
  msgstr ""
734
 
735
- #: src/Admin/Pages/Test.php:600
736
  msgid "Typically this error is returned when you are sending too many e-mails or e-mails that have been identified as spam."
737
  msgstr ""
738
 
739
- #: src/Admin/Pages/Test.php:603
740
  msgid "Check the emails that are sending are sending individually. Example: email is not sending to 30 recipients. You can install any WordPress e-mail logging plugin to do that."
741
  msgstr ""
742
 
743
- #: src/Admin/Pages/Test.php:604
744
  msgid "Contact your SMTP host to ask about sending/rate limits."
745
  msgstr ""
746
 
747
- #: src/Admin/Pages/Test.php:605
748
  msgid "Verify with them your SMTP account is in good standing and your account has not been flagged."
749
  msgstr ""
750
 
751
- #: src/Admin/Pages/Test.php:615
752
  msgid "Unauthenticated senders are not allowed."
753
  msgstr ""
754
 
755
- #: src/Admin/Pages/Test.php:616
756
  msgid "This means the connection to your SMTP host was made successfully, but you should enable Authentication and provide correct Username and Password."
757
  msgstr ""
758
 
759
- #: src/Admin/Pages/Test.php:619
760
  msgid "Go to WP Mail SMTP plugin Settings page."
761
  msgstr ""
762
 
763
- #: src/Admin/Pages/Test.php:620
764
  msgid "Enable Authentication"
765
  msgstr ""
766
 
767
- #: src/Admin/Pages/Test.php:621
768
  msgid "Enter correct SMTP Username (usually this is an email address) and Password in the appropriate fields."
769
  msgstr ""
770
 
771
- #: src/Admin/Pages/Test.php:631
772
  msgid "Could not connect to the SMTP host."
773
  msgstr ""
774
 
775
- #: src/Admin/Pages/Test.php:639
776
- #: src/Admin/Pages/Test.php:975
777
  msgid "Typically this error is returned for one of the following reasons:"
778
  msgstr ""
779
 
780
- #: src/Admin/Pages/Test.php:640
781
  msgid "SMTP settings are incorrect (wrong port, security setting, incorrect host)."
782
  msgstr ""
783
 
784
- #: src/Admin/Pages/Test.php:641
785
- #: src/Admin/Pages/Test.php:977
786
  msgid "Your web server is blocking the connection."
787
  msgstr ""
788
 
789
- #: src/Admin/Pages/Test.php:642
790
  msgid "Your SMTP host is rejecting the connection."
791
  msgstr ""
792
 
793
- #: src/Admin/Pages/Test.php:645
794
  msgid "Triple check your SMTP settings including host address, email, and password, port, and security."
795
  msgstr ""
796
 
797
  #. translators: %1$s - SMTP host address, %2$s - SMTP port, %3$s - SMTP encryption.
798
- #: src/Admin/Pages/Test.php:649
799
  msgid "Contact your web hosting provider and ask them to verify your server can connect to %1$s on port %2$s using %3$s encryption. Additionally, ask them if a firewall or security policy may be preventing the connection - many shared hosts block certain ports.<br><strong>Note: this is the most common cause of this issue.</strong>"
800
  msgstr ""
801
 
802
- #: src/Admin/Pages/Test.php:662
803
  msgid "no"
804
  msgstr ""
805
 
806
- #: src/Admin/Pages/Test.php:675
807
- #: src/Admin/Pages/Test.php:690
808
- #: src/Admin/Pages/Test.php:706
809
  msgid "Mailgun failed."
810
  msgstr ""
811
 
812
- #: src/Admin/Pages/Test.php:676
813
  msgid "It seems that you forgot to activate your Mailgun account."
814
  msgstr ""
815
 
816
- #: src/Admin/Pages/Test.php:679
817
  msgid "Check your inbox you used to create a Mailgun account. Click the activation link in an email from Mailgun."
818
  msgstr ""
819
 
820
- #: src/Admin/Pages/Test.php:680
821
  msgid "If you do not see activation email, go to your Mailgun control panel and resend the activation email."
822
  msgstr ""
823
 
824
- #: src/Admin/Pages/Test.php:691
825
  msgid "Typically this error is because there is an issue with your Mailgun settings, in many cases the API key."
826
  msgstr ""
827
 
828
- #: src/Admin/Pages/Test.php:694
829
  msgid "Verify your API key is correct."
830
  msgstr ""
831
 
832
- #: src/Admin/Pages/Test.php:695
833
  msgid "Go to your Mailgun account and view your API key."
834
  msgstr ""
835
 
836
- #: src/Admin/Pages/Test.php:696
837
  msgid "Note that the API key includes the \"key\" prefix, so make sure that it is in the WP Mail SMTP Mailgun API setting."
838
  msgstr ""
839
 
840
- #: src/Admin/Pages/Test.php:707
841
  msgid "Your Mailgun account does not have access to send emails."
842
  msgstr ""
843
 
844
- #: src/Admin/Pages/Test.php:708
845
  msgid "Typically this error is because you have not set up and/or complete domain name verification for your Mailgun account."
846
  msgstr ""
847
 
848
  #. translators: %s - Mailgun documentation URL.
849
- #: src/Admin/Pages/Test.php:714
850
  msgid "Go to our how-to guide for setting up <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">Mailgun with WP Mail SMTP</a>."
851
  msgstr ""
852
 
853
- #: src/Admin/Pages/Test.php:725
854
  msgid "Complete the steps in section \"2. Verify Your Domain\"."
855
  msgstr ""
856
 
857
- #: src/Admin/Pages/Test.php:735
858
- #: src/Admin/Pages/Test.php:786
859
- #: src/Admin/Pages/Test.php:807
860
- #: src/Admin/Pages/Test.php:834
861
- #: src/Admin/Pages/Test.php:850
862
- #: src/Admin/Pages/Test.php:905
863
- #: src/Admin/Pages/Test.php:932
864
  msgid "Google API Error."
865
  msgstr ""
866
 
867
- #: src/Admin/Pages/Test.php:736
868
  msgid "You have not properly configured Gmail mailer."
869
  msgstr ""
870
 
871
- #: src/Admin/Pages/Test.php:737
872
  msgid "Make sure that you have clicked the \"Allow plugin to send emails using your Google account\" button under Gmail settings."
873
  msgstr ""
874
 
875
- #: src/Admin/Pages/Test.php:740
876
  msgid "Go to plugin Settings page and click the \"Allow plugin to send emails using your Google account\" button."
877
  msgstr ""
878
 
879
- #: src/Admin/Pages/Test.php:741
880
  msgid "After the click you should be redirected to a Gmail authorization screen, where you will be asked a permission to send emails on your behalf."
881
  msgstr ""
882
 
883
- #: src/Admin/Pages/Test.php:742
884
  msgid "Please click \"Agree\", if you see that button. If not - you will need to enable less secure apps first:"
885
  msgstr ""
886
 
887
  #. translators: %s - Google support article URL.
888
- #: src/Admin/Pages/Test.php:748
889
  msgid "if you are using regular Gmail account, please <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">read this article</a> to proceed."
890
  msgstr ""
891
 
892
  #. translators: %s - Google support article URL.
893
- #: src/Admin/Pages/Test.php:764
894
  msgid "if you are using G Suite, please <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">read this article</a> to proceed."
895
  msgstr ""
896
 
897
- #: src/Admin/Pages/Test.php:787
898
  msgid "Typically this error is because address the email was sent to is invalid or was empty."
899
  msgstr ""
900
 
901
- #: src/Admin/Pages/Test.php:790
902
  msgid "Check the \"Send To\" email address used and confirm it is a valid email and was not empty."
903
  msgstr ""
904
 
905
  #. translators: 1 - correct email address example. 2 - incorrect email address example.
906
- #: src/Admin/Pages/Test.php:793
907
  msgid "It should be something like this: %1$s. These are incorrect values: %2$s."
908
  msgstr ""
909
 
910
- #: src/Admin/Pages/Test.php:797
911
  msgid "Make sure that the generated email has a TO header, useful when you are responsible for email creation."
912
  msgstr ""
913
 
914
- #: src/Admin/Pages/Test.php:808
915
  msgid "Unfortunately, this error can be due to many different reasons."
916
  msgstr ""
917
 
918
  #. translators: %s - Blog article URL.
919
- #: src/Admin/Pages/Test.php:814
920
  msgid "Please <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">read this article</a> to learn more about what can cause this error and how it can be resolved."
921
  msgstr ""
922
 
923
- #: src/Admin/Pages/Test.php:835
924
  msgid "Authentication code that Google returned to you has already been used on your previous auth attempt."
925
  msgstr ""
926
 
927
- #: src/Admin/Pages/Test.php:838
928
  msgid "Make sure that you are not trying to manually clean up the plugin options to retry the \"Allow...\" step."
929
  msgstr ""
930
 
931
- #: src/Admin/Pages/Test.php:839
932
  msgid "Reinstall the plugin with clean plugin data turned on on Misc page. This will remove all the plugin options and you will be safe to retry."
933
  msgstr ""
934
 
935
- #: src/Admin/Pages/Test.php:840
936
  msgid "Make sure there is no aggressive caching on site admin area pages or try to clean cache between attempts."
937
  msgstr ""
938
 
939
- #: src/Admin/Pages/Test.php:851
940
  msgid "There are various reasons for that, please review the steps below."
941
  msgstr ""
942
 
943
  #. translators: %s - Google G Suite Admin area URL.
944
- #: src/Admin/Pages/Test.php:857
945
  msgid "Make sure that your G Suite trial period has not expired. You can check the status <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>."
946
  msgstr ""
947
 
948
  #. translators: %s - Google G Suite Admin area URL.
949
- #: src/Admin/Pages/Test.php:871
950
  msgid "Make sure that Gmail app in your G Suite is actually enabled. You can check that in Apps list in <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">G Suite Admin</a> area."
951
  msgstr ""
952
 
953
  #. translators: %s - Google Developers Console URL.
954
- #: src/Admin/Pages/Test.php:885
955
  msgid "Make sure that you have Gmail API enabled, and you can do that <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>."
956
  msgstr ""
957
 
958
- #: src/Admin/Pages/Test.php:908
959
- #: src/Admin/Pages/Test.php:936
960
  msgid "Make sure that the used Client ID/Secret correspond to a proper project that has Gmail API enabled."
961
  msgstr ""
962
 
963
  #. translators: %s - WPForms.com tutorial URL.
964
- #: src/Admin/Pages/Test.php:912
965
  msgid "Please follow our <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">Gmail tutorial</a> to be sure that all the correct project and data is applied."
966
  msgstr ""
967
 
968
- #: src/Admin/Pages/Test.php:933
969
  msgid "You may have added a new API to a project"
970
  msgstr ""
971
 
972
- #: src/Admin/Pages/Test.php:937
973
  msgid "Try to use a separate project for your emails, so the project has only 1 Gmail API in it enabled. You will need to remove the old project and create a new one from scratch."
974
  msgstr ""
975
 
976
- #: src/Admin/Pages/Test.php:973
977
  msgid "An issue was detected."
978
  msgstr ""
979
 
980
- #: src/Admin/Pages/Test.php:974
981
  msgid "This means your test email was unable to be sent."
982
  msgstr ""
983
 
984
- #: src/Admin/Pages/Test.php:976
985
  msgid "Plugin settings are incorrect (wrong SMTP settings, invalid Mailer configuration, etc)."
986
  msgstr ""
987
 
988
- #: src/Admin/Pages/Test.php:978
989
  msgid "Your host is rejecting the connection."
990
  msgstr ""
991
 
992
- #: src/Admin/Pages/Test.php:981
993
  msgid "Triple check the plugin settings, consider reconfiguring to make sure everything is correct (eg bad copy and paste)."
994
  msgstr ""
995
 
996
- #: src/Admin/Pages/Test.php:983
997
  msgid "Contact your web hosting provider and ask them to verify your server can make outside connections. Additionally, ask them if a firewall or security policy may be preventing the connection - many shared hosts block certain ports.<br><strong>Note: this is the most common cause of this issue.</strong>"
998
  msgstr ""
999
 
1000
- #: src/Admin/Pages/Test.php:989
1001
  msgid "Try using a different mailer."
1002
  msgstr ""
1003
 
1004
- #: src/Admin/Pages/Test.php:1008
1005
  msgid "There was a problem while sending the test email."
1006
  msgstr ""
1007
 
1008
- #: src/Admin/Pages/Test.php:1018
1009
  msgid "Recommended next steps:"
1010
  msgstr ""
1011
 
1012
- #: src/Admin/Pages/Test.php:1028
1013
  msgid "Need support?"
1014
  msgstr ""
1015
 
1016
  #. translators: %s - WPMailSMTP.com account area link.
1017
- #: src/Admin/Pages/Test.php:1036
1018
  msgid "As a WP Mail SMTP Pro user you have access to WP Mail SMTP priority support. Please log in to your WPMailSMTP.com account and <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">submit a support ticket</a>."
1019
  msgstr ""
1020
 
1021
- #: src/Admin/Pages/Test.php:1053
1022
  msgid "WP Mail SMTP is a free plugin, and the team behind WPForms maintains it to give back to the WordPress community."
1023
  msgstr ""
1024
 
1025
  #. translators: %s - WPMailSMTP.com URL.
1026
- #: src/Admin/Pages/Test.php:1060
1027
  msgid "To access our world class support, please <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">upgrade to WP Mail SMTP Pro</a>. Along with getting expert support, you will also get Notification controls, Email Logging, and integrations for Amazon SES, Office 365, and Outlook.com."
1028
  msgstr ""
1029
 
1030
- #: src/Admin/Pages/Test.php:1075
1031
  msgid "Additionally, you can take advantage of our White Glove Setup. Sit back and relax while we handle everything for you! If you simply don't have time or maybe you feel a bit in over your head - we got you covered."
1032
  msgstr ""
1033
 
1034
- #: src/Admin/Pages/Test.php:1081
1035
  msgid "As a valued WP Mail SMTP user, you will get <span class=\"price-off\">20% off regular pricing</span>, automatically applied at checkout!"
1036
  msgstr ""
1037
 
1038
  #. translators: %1$s - WP Mail SMTP support policy URL, %2$s - WP Mail SMTP support forum URL, %3$s - WPMailSMTP.com URL.
1039
- #: src/Admin/Pages/Test.php:1095
1040
  msgid "Alternatively, we also offer <a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">limited support</a> on the WordPress.org support forums. You can <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">create a support thread</a> there, but please understand that free support is not guaranteed and is limited to simple issues. If you have an urgent or complex issue, then please consider <a href=\"%3$s\" target=\"_blank\" rel=\"noopener noreferrer\">upgrading to WP Mail SMTP Pro</a> to access our priority support ticket system."
1041
  msgstr ""
1042
 
1043
- #: src/Admin/Pages/Test.php:1116
1044
  msgid "Click here to view the full Error Log for debugging"
1045
  msgstr ""
1046
 
1047
- #: src/Admin/Pages/Test.php:1125
1048
  msgid "Please copy only the content of the error debug message above, identified with an orange left border, into the support forum topic if you experience any issues."
1049
  msgstr ""
1050
 
@@ -1064,25 +1138,25 @@ msgid "<strong>Note:</strong> WP Mail SMTP plugin is disabled on your site until
1064
  msgstr ""
1065
 
1066
  #. translators: %1$s - WP Mail SMTP plugin name; %2$s - WPForms.com URL to a related doc.
1067
- #: src/Core.php:365
1068
  msgid "Your site is running an outdated version of PHP that is no longer supported and may cause issues with %1$s. <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">Read more</a> for additional information."
1069
  msgstr ""
1070
 
1071
- #: src/Core.php:379
1072
  msgid "<strong>Please Note:</strong> Support for PHP 5.3-5.5 will be discontinued in 2019. After this, if no further action is taken, WP Mail SMTP functionality will be disabled."
1073
  msgstr ""
1074
 
1075
  #. translators: %1$s - plugin name and its version, %2$s - plugin Misc settings page.
1076
- #: src/Core.php:418
1077
  msgid "<strong>EMAILING DISABLED:</strong> The %1$s is currently blocking all emails from being sent. To send emails, go to plugin <a href=\"%2$s\">Misc settings</a> and disable the \"Do Not Send\" option."
1078
  msgstr ""
1079
 
1080
  #. translators: %s - plugin name and its version.
1081
- #: src/Core.php:447
1082
  msgid "<strong>EMAIL DELIVERY ERROR:</strong> the plugin %s logged this error during the last time it tried to send an email:"
1083
  msgstr ""
1084
 
1085
- #: src/Core.php:477
1086
  msgid "Consider running an email test after fixing it."
1087
  msgstr ""
1088
 
@@ -1094,57 +1168,61 @@ msgstr ""
1094
  msgid "Gmail"
1095
  msgstr ""
1096
 
1097
- #. translators: %1$s - opening link tag; %2$s - closing link tag.
1098
- #: src/Providers/Gmail/Options.php:36
1099
- msgid "Send emails using your Gmail or G Suite (formerly Google Apps) account, all while keeping your login credentials safe. Other Google SMTP methods require enabling less secure apps in your account and entering your password. However, this integration uses the Google API to improve email delivery issues while keeping your site secure.<br><br>Read our %1$sGmail documentation%2$s to learn how to configure Gmail or G Suite."
 
 
 
 
1100
  msgstr ""
1101
 
1102
- #: src/Providers/Gmail/Options.php:71
1103
  msgid "Client ID"
1104
  msgstr ""
1105
 
1106
- #: src/Providers/Gmail/Options.php:86
1107
  msgid "Client Secret"
1108
  msgstr ""
1109
 
1110
- #: src/Providers/Gmail/Options.php:108
1111
  msgid "Authorized redirect URI"
1112
  msgstr ""
1113
 
1114
- #: src/Providers/Gmail/Options.php:116
1115
  msgid "Copy URL to clipboard"
1116
  msgstr ""
1117
 
1118
- #: src/Providers/Gmail/Options.php:121
1119
  msgid "Please copy this URL into the \"Authorized redirect URIs\" field of your Google web application."
1120
  msgstr ""
1121
 
1122
- #: src/Providers/Gmail/Options.php:130
1123
  msgid "Authorization"
1124
  msgstr ""
1125
 
1126
- #: src/Providers/Gmail/Options.php:158
1127
  msgid "Allow plugin to send emails using your Google account"
1128
  msgstr ""
1129
 
1130
- #: src/Providers/Gmail/Options.php:161
1131
  msgid "Click the button above to confirm authorization."
1132
  msgstr ""
1133
 
1134
- #: src/Providers/Gmail/Options.php:167
1135
  msgid "Remove Connection"
1136
  msgstr ""
1137
 
1138
  #. translators: %s - email address, as received from Google API.
1139
- #: src/Providers/Gmail/Options.php:176
1140
  msgid "Connected as %s"
1141
  msgstr ""
1142
 
1143
- #: src/Providers/Gmail/Options.php:183
1144
  msgid "Removing the connection will give you an ability to redo the connection or link to another Google account."
1145
  msgstr ""
1146
 
1147
- #: src/Providers/Gmail/Options.php:191
1148
  msgid "You need to save settings with Client ID and Client Secret before you can proceed."
1149
  msgstr ""
1150
 
@@ -1216,12 +1294,12 @@ msgstr ""
1216
  msgid "<a href=\"%s\" rel=\"\" target=\"_blank\">More information</a> on Mailgun.com."
1217
  msgstr ""
1218
 
1219
- #: src/Providers/OptionsAbstract.php:126
1220
  #: wp-mail-smtp-0.11.2.php:376
1221
  msgid "SMTP Host"
1222
  msgstr ""
1223
 
1224
- #: src/Providers/OptionsAbstract.php:140
1225
  #: wp-mail-smtp-0.11.2.php:391
1226
  #: wp-mail-smtp-0.11.2.php:395
1227
  #: wp-mail-smtp-0.11.2.php:510
@@ -1229,90 +1307,90 @@ msgstr ""
1229
  msgid "Encryption"
1230
  msgstr ""
1231
 
1232
- #: src/Providers/OptionsAbstract.php:150
1233
  msgid "None"
1234
  msgstr ""
1235
 
1236
- #: src/Providers/OptionsAbstract.php:159
1237
  msgid "SSL"
1238
  msgstr ""
1239
 
1240
- #: src/Providers/OptionsAbstract.php:168
1241
  msgid "TLS"
1242
  msgstr ""
1243
 
1244
- #: src/Providers/OptionsAbstract.php:172
1245
  msgid "For most servers TLS is the recommended option. If your SMTP provider offers both SSL and TLS options, we recommend using TLS."
1246
  msgstr ""
1247
 
1248
- #: src/Providers/OptionsAbstract.php:180
1249
  #: wp-mail-smtp-0.11.2.php:384
1250
  #: wp-mail-smtp-0.11.2.php:502
1251
  msgid "SMTP Port"
1252
  msgstr ""
1253
 
1254
- #: src/Providers/OptionsAbstract.php:194
1255
  msgid "Auto TLS"
1256
  msgstr ""
1257
 
1258
- #: src/Providers/OptionsAbstract.php:208
1259
  msgid "By default TLS encryption is automatically used if the server supports it, which is recommended. In some cases, due to server misconfigurations, this can cause issues and may need to be disabled."
1260
  msgstr ""
1261
 
1262
- #: src/Providers/OptionsAbstract.php:216
1263
  #: wp-mail-smtp-0.11.2.php:418
1264
  #: wp-mail-smtp-0.11.2.php:422
1265
  msgid "Authentication"
1266
  msgstr ""
1267
 
1268
- #: src/Providers/OptionsAbstract.php:235
1269
  msgid "SMTP Username"
1270
  msgstr ""
1271
 
1272
- #: src/Providers/OptionsAbstract.php:249
1273
  msgid "SMTP Password"
1274
  msgstr ""
1275
 
1276
  #. translators: %s - constant name: WPMS_SMTP_PASS.
1277
- #: src/Providers/OptionsAbstract.php:261
1278
  msgid "To change the password you need to change the value of the constant there: %s"
1279
  msgstr ""
1280
 
1281
  #. translators: %1$s - wp-config.php file, %2$s - WPMS_ON constant name.
1282
- #: src/Providers/OptionsAbstract.php:269
1283
  msgid "If you want to disable the use of constants, find in %1$s file the constant %2$s and turn if off:"
1284
  msgstr ""
1285
 
1286
- #: src/Providers/OptionsAbstract.php:279
1287
  msgid "All the defined constants will stop working and you will be able to change all the values on this page."
1288
  msgstr ""
1289
 
1290
- #: src/Providers/OptionsAbstract.php:287
1291
  msgid "The password is stored in plain text. We highly recommend you set up your password in your WordPress configuration file for improved security."
1292
  msgstr ""
1293
 
1294
  #. translators: %s - wp-config.php.
1295
- #: src/Providers/OptionsAbstract.php:292
1296
  msgid "To do this add the lines below to your %s file:"
1297
  msgstr ""
1298
 
1299
  #. translators: %1$s - Provider name; %2$s - PHP version required by Provider; %3$s - current PHP version.
1300
- #: src/Providers/OptionsAbstract.php:333
1301
  msgid "%1$s requires PHP %2$s to work and does not support your current PHP version %3$s. Please contact your host and request a PHP upgrade to the latest one."
1302
  msgstr ""
1303
 
1304
- #: src/Providers/OptionsAbstract.php:340
1305
- #: src/Providers/OptionsAbstract.php:364
1306
- msgid "Meanwhile you can switch to the \"Other SMTP\" Mailer option."
1307
  msgstr ""
1308
 
1309
  #. translators: %s - Provider name.
1310
- #: src/Providers/OptionsAbstract.php:359
1311
  msgid "%s requires a SSL certificate on a site to work and does not support you current installation. Please contact your host and request a SSL certificate or install a free one, like Let's Encrypt."
1312
  msgstr ""
1313
 
1314
  #. translators: %1$s - constant name, %2$s - file name.
1315
- #: src/Providers/OptionsAbstract.php:383
1316
  msgid "The value of this field was set using a constant %1$s most likely inside %2$s of your WordPress installation."
1317
  msgstr ""
1318
 
@@ -1330,6 +1408,7 @@ msgid "%1$sSendGrid%2$s is one of the leading transactional email services, send
1330
  msgstr ""
1331
 
1332
  #: src/Providers/Sendgrid/Options.php:57
 
1333
  msgid "API Key"
1334
  msgstr ""
1335
 
@@ -1347,6 +1426,33 @@ msgstr ""
1347
  msgid "To send emails you will need only a %s access level for this API key."
1348
  msgstr ""
1349
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1350
  #: src/Providers/SMTP/Options.php:25
1351
  msgid "Other SMTP"
1352
  msgstr ""
@@ -1506,6 +1612,6 @@ msgstr ""
1506
  msgid "Your site is running an outdated version of PHP that is no longer supported and may cause issues with %1$s. %2$sRead more%3$s for additional information."
1507
  msgstr ""
1508
 
1509
- #: wp_mail_smtp.php:122
1510
  msgid "Please deactivate the free version of the WP Mail SMTP plugin before activating WP Mail SMTP Pro."
1511
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: WP Mail SMTP 1.6.0\n"
4
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-mail-smtp\n"
5
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
6
  "Language-Team: LANGUAGE <LL@li.org>\n"
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
9
  "Content-Transfer-Encoding: 8bit\n"
10
+ "POT-Creation-Date: 2019-08-21T11:54:11+03:00\n"
11
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
  "X-Generator: WP-CLI 2.2.0\n"
13
  "X-Domain: wp-mail-smtp\n"
17
  msgstr ""
18
 
19
  #. Plugin URI of the plugin
20
+ msgid "https://wpmailsmtp.com/"
 
21
  msgstr ""
22
 
23
  #. Description of the plugin
28
  msgid "WPForms"
29
  msgstr ""
30
 
31
+ #. Author URI of the plugin
32
+ msgid "https://wpforms.com/"
33
+ msgstr ""
34
+
35
  #. translators: %s - error code, returned by Google API.
36
  #: src/Admin/Area.php:112
37
  msgid "There was an error while processing the authentication request: %s. Please try again."
66
 
67
  #: src/Admin/Area.php:208
68
  #: src/Admin/Area.php:209
69
+ #: src/Admin/Area.php:755
70
  #: wp-mail-smtp-0.11.2.php:709
71
  msgid "Settings"
72
  msgstr ""
73
 
74
  #: src/Admin/Area.php:216
75
  #: src/Admin/Area.php:217
76
+ #: src/Admin/Area.php:756
77
  #: src/Admin/Pages/About.php:615
78
  #: src/Admin/Pages/Logs.php:40
79
+ #: src/Admin/Pages/LogsTab.php:31
80
  msgid "Email Log"
81
  msgstr ""
82
 
128
  msgid "Please rate <strong>WP Mail SMTP</strong> <a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">&#9733;&#9733;&#9733;&#9733;&#9733;</a> on <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress.org</a> to help us spread the word. Thank you from the WP Mail SMTP team!"
129
  msgstr ""
130
 
131
+ #: src/Admin/Area.php:700
132
  msgid "WP Mail SMTP Pro related message was successfully dismissed."
133
  msgstr ""
134
 
135
+ #: src/Admin/Area.php:719
136
+ msgid "Educational notice for this mailer was successfully dismissed."
137
+ msgstr ""
138
+
139
  #: src/Admin/PageAbstract.php:81
140
  msgid "Save Settings"
141
  msgstr ""
160
 
161
  #. translators: %1$s - WPBeginner URL, %2$s - OptinMonster URL, %3$s - MonsterInsights URL.
162
  #: src/Admin/Pages/About.php:184
163
+ msgid "WP Mail SMTP is brought to you by the same team that's behind the most user friendly WordPress forms, <a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">WPForms</a>, the largest WordPress resource site, <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">WPBeginner</a>, the most popular lead-generation software, <a href=\"%3$s\" target=\"_blank\" rel=\"noopener noreferrer\">OptinMonster</a>, and the best WordPress analytics plugin, <a href=\"%4$s\" target=\"_blank\" rel=\"noopener noreferrer\">MonsterInsights</a>."
164
  msgstr ""
165
 
166
  #: src/Admin/Pages/About.php:201
263
  msgstr ""
264
 
265
  #: src/Admin/Pages/About.php:616
266
+ #: src/Admin/Pages/ControlTab.php:27
267
  msgid "Email Controls"
268
  msgstr ""
269
 
307
  msgid "Priority Support"
308
  msgstr ""
309
 
310
+ #: src/Admin/Pages/ControlTab.php:46
311
+ msgid "Comment Notifications"
312
  msgstr ""
313
 
314
+ #: src/Admin/Pages/ControlTab.php:47
315
+ msgid "Manage emails sent when comments are published or awaiting moderation."
316
  msgstr ""
317
 
318
+ #: src/Admin/Pages/ControlTab.php:51
319
+ msgid "Site Admin Email Change Notifications"
320
  msgstr ""
321
 
322
+ #: src/Admin/Pages/ControlTab.php:52
323
+ msgid "Manage emails sent when site admin's account has been changed."
324
  msgstr ""
325
 
326
+ #: src/Admin/Pages/ControlTab.php:56
327
+ msgid "User Change Notifications"
328
  msgstr ""
329
 
330
+ #: src/Admin/Pages/ControlTab.php:57
331
+ msgid "Limit emails triggered by password changed/reset, email changed, and more."
332
  msgstr ""
333
 
334
+ #: src/Admin/Pages/ControlTab.php:61
335
+ msgid "Personal Data Requests Notifications"
336
  msgstr ""
337
 
338
+ #: src/Admin/Pages/ControlTab.php:62
339
+ msgid "Control emails for data requests and data removal actions."
340
  msgstr ""
341
 
342
+ #: src/Admin/Pages/ControlTab.php:66
343
+ msgid "Automatic Update Notifications"
344
  msgstr ""
345
 
346
+ #: src/Admin/Pages/ControlTab.php:67
347
+ msgid "Manage emails sent by the core automatic update process."
348
  msgstr ""
349
 
350
+ #: src/Admin/Pages/ControlTab.php:71
351
+ msgid "New User Notifications"
352
+ msgstr ""
353
+
354
+ #: src/Admin/Pages/ControlTab.php:72
355
+ msgid "Toggle emails sent to both user and site administrator about new user accounts."
356
+ msgstr ""
357
+
358
+ #: src/Admin/Pages/ControlTab.php:79
359
+ msgid "Unlock Email Controls"
360
+ msgstr ""
361
+
362
+ #: src/Admin/Pages/ControlTab.php:82
363
+ msgid "Email Controls allows you to granularly manage emails sent by WordPress.
"
364
+ msgstr ""
365
+
366
+ #: src/Admin/Pages/ControlTab.php:106
367
+ #: src/Admin/Pages/Logs.php:77
368
+ msgid "Upgrade to WP Mail SMTP Pro"
369
+ msgstr ""
370
+
371
+ #: src/Admin/Pages/Logs.php:63
372
+ msgid "Unlock Email Logging"
373
+ msgstr ""
374
+
375
+ #: src/Admin/Pages/Logs.php:66
376
+ msgid "Keep track of every email sent from your WordPress site with email logging.
"
377
+ msgstr ""
378
+
379
+ #: src/Admin/Pages/Logs.php:67
380
+ msgid "Troubleshoot sending issues, recover lost emails, and more!"
381
+ msgstr ""
382
+
383
+ #: src/Admin/Pages/Logs.php:71
384
+ msgid "Logs Archive Page Screenshot"
385
+ msgstr ""
386
+
387
+ #: src/Admin/Pages/Logs.php:72
388
+ msgid "Logs Single Page Screenshot"
389
  msgstr ""
390
 
391
+ #: src/Admin/Pages/MiscTab.php:24
392
+ msgid "Misc"
393
+ msgstr ""
394
+
395
+ #: src/Admin/Pages/MiscTab.php:56
396
  msgid "Do Not Send"
397
  msgstr ""
398
 
399
+ #: src/Admin/Pages/MiscTab.php:65
400
  msgid "Check this if you would like to stop sending all emails."
401
  msgstr ""
402
 
403
+ #: src/Admin/Pages/MiscTab.php:71
404
  msgid "Some plugins, like BuddyPress and Events Manager, are using own email delivery solutions. By default, this option does not block their emails, as those plugins do not use default <code>wp_mail()</code> function to send emails."
405
  msgstr ""
406
 
407
+ #: src/Admin/Pages/MiscTab.php:79
408
  msgid "You will need to consult with their documentation to switch them to use default WordPress email delivery."
409
  msgstr ""
410
 
411
+ #: src/Admin/Pages/MiscTab.php:81
412
  msgid "Test emails are allowed to be sent, regardless of this option."
413
  msgstr ""
414
 
415
+ #: src/Admin/Pages/MiscTab.php:90
416
  #: wp-mail-smtp-0.11.2.php:346
417
  #: wp-mail-smtp-0.11.2.php:351
418
  msgid "Hide Announcements"
419
  msgstr ""
420
 
421
+ #: src/Admin/Pages/MiscTab.php:99
422
  #: wp-mail-smtp-0.11.2.php:356
423
  msgid "Check this if you would like to hide plugin announcements and update details."
424
  msgstr ""
425
 
426
+ #: src/Admin/Pages/MiscTab.php:109
427
+ msgid "Hide Email Delivery Errors"
428
+ msgstr ""
429
+
430
+ #: src/Admin/Pages/MiscTab.php:125
431
+ msgid "Check this if you would like to hide warnings alerting of email delivery errors."
432
+ msgstr ""
433
+
434
+ #. translators: %s - filter that was used to disabled.
435
+ #: src/Admin/Pages/MiscTab.php:132
436
+ msgid "Email Delivery Errors were disabled using a %s filter."
437
+ msgstr ""
438
+
439
+ #: src/Admin/Pages/MiscTab.php:141
440
+ msgid "<strong>This is not recommended</strong> and should only be done for staging or development sites."
441
+ msgstr ""
442
+
443
+ #: src/Admin/Pages/MiscTab.php:156
444
  msgid "Uninstall WP Mail SMTP"
445
  msgstr ""
446
 
447
+ #: src/Admin/Pages/MiscTab.php:164
448
  msgid "Check this if you would like to remove ALL WP Mail SMTP data upon plugin deletion. All settings will be unrecoverable."
449
  msgstr ""
450
 
451
+ #: src/Admin/Pages/MiscTab.php:199
452
+ #: src/Admin/Pages/SettingsTab.php:521
453
  msgid "Settings were successfully saved."
454
  msgstr ""
455
 
456
+ #: src/Admin/Pages/SettingsTab.php:36
457
+ msgid "General"
458
+ msgstr ""
459
+
460
+ #: src/Admin/Pages/SettingsTab.php:64
461
  msgid "License"
462
  msgstr ""
463
 
464
+ #: src/Admin/Pages/SettingsTab.php:67
465
  msgid "Your license key provides access to updates and support."
466
  msgstr ""
467
 
468
+ #: src/Admin/Pages/SettingsTab.php:75
469
  msgid "License Key"
470
  msgstr ""
471
 
472
+ #: src/Admin/Pages/SettingsTab.php:85
473
  msgid "Mail"
474
  msgstr ""
475
 
476
+ #: src/Admin/Pages/SettingsTab.php:92
477
  #: wp-mail-smtp-0.11.2.php:247
478
  msgid "From Email"
479
  msgstr ""
480
 
481
+ #: src/Admin/Pages/SettingsTab.php:103
482
  msgid "The email address which emails are sent from."
483
  msgstr ""
484
 
485
+ #: src/Admin/Pages/SettingsTab.php:104
486
  msgid "If you using an email provider (Gmail, Yahoo, Outlook.com, etc) this should be your email address for that account."
487
  msgstr ""
488
 
489
+ #: src/Admin/Pages/SettingsTab.php:107
490
  msgid "Please note that other plugins can change this, to prevent this use the setting below."
491
  msgstr ""
492
 
493
+ #: src/Admin/Pages/SettingsTab.php:119
494
  msgid "Force From Email"
495
  msgstr ""
496
 
497
+ #: src/Admin/Pages/SettingsTab.php:124
498
  msgid "Current provider will automatically force From Email to be the email address that you use to set up the connection below."
499
  msgstr ""
500
 
501
+ #: src/Admin/Pages/SettingsTab.php:128
502
  msgid "If checked, the From Email setting above will be used for all emails, ignoring values set by other plugins."
503
  msgstr ""
504
 
505
+ #: src/Admin/Pages/SettingsTab.php:138
506
  #: wp-mail-smtp-0.11.2.php:266
507
  msgid "From Name"
508
  msgstr ""
509
 
510
+ #: src/Admin/Pages/SettingsTab.php:149
511
  msgid "The name which emails are sent from."
512
  msgstr ""
513
 
514
+ #: src/Admin/Pages/SettingsTab.php:161
515
  msgid "Force From Name"
516
  msgstr ""
517
 
518
+ #: src/Admin/Pages/SettingsTab.php:166
519
  msgid "Current provider doesn't support setting and forcing From Name. Emails will be sent on behalf of the account name used to setup the connection below."
520
  msgstr ""
521
 
522
+ #: src/Admin/Pages/SettingsTab.php:170
523
  msgid "If checked, the From Name setting above will be used for all emails, ignoring values set by other plugins."
524
  msgstr ""
525
 
526
+ #: src/Admin/Pages/SettingsTab.php:179
527
  #: wp-mail-smtp-0.11.2.php:322
528
  #: wp-mail-smtp-0.11.2.php:327
529
  msgid "Return Path"
530
  msgstr ""
531
 
532
+ #: src/Admin/Pages/SettingsTab.php:188
533
  #: wp-mail-smtp-0.11.2.php:332
534
  msgid "Set the return-path to match the From Email"
535
  msgstr ""
536
 
537
+ #: src/Admin/Pages/SettingsTab.php:192
538
  #: wp-mail-smtp-0.11.2.php:336
539
  msgid "Return Path indicates where non-delivery receipts - or bounce messages - are to be sent."
540
  msgstr ""
541
 
542
+ #: src/Admin/Pages/SettingsTab.php:193
543
  msgid "If unchecked, bounce messages may be lost. Some providers may ignore this option."
544
  msgstr ""
545
 
546
+ #: src/Admin/Pages/SettingsTab.php:201
547
  #: wp-mail-smtp-0.11.2.php:281
548
  #: wp-mail-smtp-0.11.2.php:286
549
  msgid "Mailer"
550
  msgstr ""
551
 
552
+ #: src/Admin/Pages/SettingsTab.php:254
553
+ msgid "Dismiss this notice"
554
+ msgstr ""
555
+
556
+ #: src/Admin/Pages/SettingsTab.php:295
557
  msgid "You're using WP Mail SMTP Lite - no license needed. Enjoy!"
558
  msgstr ""
559
 
560
  #. translators: %s - WPMailSMTP.com upgrade URL.
561
+ #: src/Admin/Pages/SettingsTab.php:301
562
  msgid "To unlock more features consider <strong><a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"wp-mail-smtp-upgrade-modal\">upgrading to PRO</a></strong>."
563
  msgstr ""
564
 
565
+ #: src/Admin/Pages/SettingsTab.php:320
566
  msgid "As a valued WP Mail SMTP Lite user you receive <strong>20% off</strong>, automatically applied at checkout!"
567
  msgstr ""
568
 
569
+ #: src/Admin/Pages/SettingsTab.php:381
570
  msgid "Get WP Mail SMTP Pro and Unlock all the Powerful Features"
571
  msgstr ""
572
 
573
+ #: src/Admin/Pages/SettingsTab.php:385
574
  msgid "Thanks for being a loyal WP Mail SMTP user. Upgrade to WP Mail SMTP Pro to unlock more awesome features and experience why WP Mail SMTP is the most popular SMTP plugin."
575
  msgstr ""
576
 
577
+ #: src/Admin/Pages/SettingsTab.php:389
578
  msgid "We know that you will truly love WP Mail SMTP. It's used by over 1,000,000 websites."
579
  msgstr ""
580
 
581
+ #: src/Admin/Pages/SettingsTab.php:392
582
  msgid "Pro Features:"
583
  msgstr ""
584
 
585
+ #: src/Admin/Pages/SettingsTab.php:396
586
  msgid "Manage Notifications - control which emails your site sends"
587
  msgstr ""
588
 
589
+ #: src/Admin/Pages/SettingsTab.php:397
590
  msgid "Email Logging - keep track of every email sent from your site"
591
  msgstr ""
592
 
593
+ #: src/Admin/Pages/SettingsTab.php:398
594
  msgid "Office 365 - send emails using your Office 365 account"
595
  msgstr ""
596
 
597
+ #: src/Admin/Pages/SettingsTab.php:399
598
  msgid "Amazon SES - harness the power of AWS"
599
  msgstr ""
600
 
601
+ #: src/Admin/Pages/SettingsTab.php:400
602
  msgid "Outlook.com - send emails using your Outlook.com account"
603
  msgstr ""
604
 
605
+ #: src/Admin/Pages/SettingsTab.php:401
606
  msgid "Access to our world class support team"
607
  msgstr ""
608
 
609
+ #: src/Admin/Pages/SettingsTab.php:404
610
  msgid "White Glove Setup - sit back and relax while we handle everything for you"
611
  msgstr ""
612
 
613
+ #: src/Admin/Pages/SettingsTab.php:405
614
  msgid "Install WP Mail SMTP Pro plugin"
615
  msgstr ""
616
 
617
+ #: src/Admin/Pages/SettingsTab.php:406
618
  msgid "Set up domain name verification (DNS)"
619
  msgstr ""
620
 
621
+ #: src/Admin/Pages/SettingsTab.php:407
622
  msgid "Configure Mailgun service"
623
  msgstr ""
624
 
625
+ #: src/Admin/Pages/SettingsTab.php:408
626
  msgid "Set up WP Mail SMTP Pro plugin"
627
  msgstr ""
628
 
629
+ #: src/Admin/Pages/SettingsTab.php:409
630
  msgid "Test and verify email delivery"
631
  msgstr ""
632
 
633
  #. translators: %s - WPMailSMTP.com URL.
634
+ #: src/Admin/Pages/SettingsTab.php:417
635
  msgid "<a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">Get WP Mail SMTP Pro Today and Unlock all the Powerful Features &raquo;</a>"
636
  msgstr ""
637
 
638
+ #: src/Admin/Pages/SettingsTab.php:435
639
  msgid "<strong>Bonus:</strong> WP Mail SMTP users get <span class=\"price-off\">20% off regular price</span>, automatically applied at checkout."
640
  msgstr ""
641
 
642
+ #: src/Admin/Pages/TestTab.php:37
643
  msgid "Email Test"
644
  msgstr ""
645
 
646
+ #: src/Admin/Pages/TestTab.php:59
647
  #: wp-mail-smtp-0.11.2.php:549
648
  msgid "Send a Test Email"
649
  msgstr ""
650
 
651
+ #: src/Admin/Pages/TestTab.php:66
652
  msgid "Send To"
653
  msgstr ""
654
 
655
+ #: src/Admin/Pages/TestTab.php:72
656
  msgid "Enter email address where test email will be sent."
657
  msgstr ""
658
 
659
+ #: src/Admin/Pages/TestTab.php:80
660
  msgid "HTML"
661
  msgstr ""
662
 
663
+ #: src/Admin/Pages/TestTab.php:86
664
+ #: src/Providers/OptionsAbstract.php:255
665
+ #: src/Providers/OptionsAbstract.php:277
666
  msgid "On"
667
  msgstr ""
668
 
669
+ #: src/Admin/Pages/TestTab.php:87
670
+ #: src/Providers/OptionsAbstract.php:256
671
+ #: src/Providers/OptionsAbstract.php:278
672
  msgid "Off"
673
  msgstr ""
674
 
675
+ #: src/Admin/Pages/TestTab.php:90
676
  msgid "Send this email in HTML or in plain text format."
677
  msgstr ""
678
 
679
+ #: src/Admin/Pages/TestTab.php:105
680
  msgid "You cannot send an email. Mailer is not properly configured. Please check your settings."
681
  msgstr ""
682
 
683
+ #: src/Admin/Pages/TestTab.php:109
684
  msgid "Send Email"
685
  msgstr ""
686
 
687
+ #: src/Admin/Pages/TestTab.php:137
688
  msgid "Test failed. Please use a valid email address and try to resend the test email."
689
  msgstr ""
690
 
691
  #. translators: %s - email address a test email will be sent to.
692
+ #: src/Admin/Pages/TestTab.php:149
693
+ #: src/Admin/Pages/TestTab.php:155
694
  msgid "Test email to %s"
695
  msgstr ""
696
 
697
+ #: src/Admin/Pages/TestTab.php:181
698
  msgid "Test plain text email was sent successfully!"
699
  msgstr ""
700
 
701
  #. translators: %s - "HTML" in bold.
702
+ #: src/Admin/Pages/TestTab.php:185
703
  msgid "Test %s email was sent successfully! Please check your inbox to make sure it is delivered."
704
  msgstr ""
705
 
706
+ #: src/Admin/Pages/TestTab.php:513
707
  msgid "SSL certificate issue."
708
  msgstr ""
709
 
710
+ #: src/Admin/Pages/TestTab.php:514
711
  msgid "This means your web server cannot reliably make secure connections (make requests to HTTPS sites)."
712
  msgstr ""
713
 
714
+ #: src/Admin/Pages/TestTab.php:515
715
+ #: src/Admin/Pages/TestTab.php:566
716
  msgid "Typically this error is returned when web server is not configured properly."
717
  msgstr ""
718
 
719
+ #: src/Admin/Pages/TestTab.php:518
720
  msgid "Contact your web hosting provider and inform them your site has an issue with SSL certificates."
721
  msgstr ""
722
 
723
+ #: src/Admin/Pages/TestTab.php:519
724
+ #: src/Admin/Pages/TestTab.php:570
725
  msgid "The exact error you can provide them is in the Error log, available at the bottom of this page."
726
  msgstr ""
727
 
728
+ #: src/Admin/Pages/TestTab.php:520
729
+ #: src/Admin/Pages/TestTab.php:571
730
  msgid "Ask them to resolve the issue then try again."
731
  msgstr ""
732
 
733
+ #: src/Admin/Pages/TestTab.php:531
734
  msgid "Could not connect to host."
735
  msgstr ""
736
 
737
  #. translators: %s - SMTP host address.
738
+ #: src/Admin/Pages/TestTab.php:535
739
+ #: src/Admin/Pages/TestTab.php:562
740
+ #: src/Admin/Pages/TestTab.php:635
741
  msgid "This means your web server was unable to connect to %s."
742
  msgstr ""
743
 
744
+ #: src/Admin/Pages/TestTab.php:538
745
+ #: src/Admin/Pages/TestTab.php:565
746
+ #: src/Admin/Pages/TestTab.php:638
747
  msgid "This means your web server was unable to connect to the host server."
748
  msgstr ""
749
 
750
+ #: src/Admin/Pages/TestTab.php:539
751
  msgid "Typically this error is returned your web server is blocking the connections or the SMTP host denying the request."
752
  msgstr ""
753
 
754
  #. translators: %s - SMTP host address.
755
+ #: src/Admin/Pages/TestTab.php:544
756
  msgid "Contact your web hosting provider and ask them to verify your server can connect to %s. Additionally, ask them if a firewall or security policy may be preventing the connection."
757
  msgstr ""
758
 
759
+ #: src/Admin/Pages/TestTab.php:547
760
  msgid "If using \"Other SMTP\" Mailer, triple check your SMTP settings including host address, email, and password."
761
  msgstr ""
762
 
763
+ #: src/Admin/Pages/TestTab.php:548
764
  msgid "If using \"Other SMTP\" Mailer, contact your SMTP host to confirm they are accepting outside connections with the settings you have configured (address, username, port, security, etc)."
765
  msgstr ""
766
 
767
+ #: src/Admin/Pages/TestTab.php:558
768
  msgid "Could not connect to your host."
769
  msgstr ""
770
 
771
+ #: src/Admin/Pages/TestTab.php:569
772
  msgid "Contact your web hosting provider and inform them you are having issues making outbound connections."
773
  msgstr ""
774
 
775
+ #: src/Admin/Pages/TestTab.php:581
776
  msgid "Could not authenticate your SMTP account."
777
  msgstr ""
778
 
779
+ #: src/Admin/Pages/TestTab.php:582
780
  msgid "This means we were able to connect to your SMTP host, but were not able to proceed using the email/password in the settings."
781
  msgstr ""
782
 
783
+ #: src/Admin/Pages/TestTab.php:583
784
  msgid "Typically this error is returned when the email or password is not correct or is not what the SMTP host is expecting."
785
  msgstr ""
786
 
787
+ #: src/Admin/Pages/TestTab.php:586
788
  msgid "Triple check your SMTP settings including host address, email, and password. If you have recently reset your password you will need to update the settings."
789
  msgstr ""
790
 
791
+ #: src/Admin/Pages/TestTab.php:587
792
+ #: src/Admin/Pages/TestTab.php:664
793
  msgid "Contact your SMTP host to confirm you are using the correct username and password."
794
  msgstr ""
795
 
796
+ #: src/Admin/Pages/TestTab.php:588
797
+ #: src/Admin/Pages/TestTab.php:665
798
  msgid "Verify with your SMTP host that your account has permissions to send emails using outside connections."
799
  msgstr ""
800
 
801
+ #: src/Admin/Pages/TestTab.php:598
802
  msgid "Error due to unsolicited and/or bulk e-mail."
803
  msgstr ""
804
 
805
+ #: src/Admin/Pages/TestTab.php:599
806
  msgid "This means the connection to your SMTP host was made successfully, but the host rejected the email."
807
  msgstr ""
808
 
809
+ #: src/Admin/Pages/TestTab.php:600
810
  msgid "Typically this error is returned when you are sending too many e-mails or e-mails that have been identified as spam."
811
  msgstr ""
812
 
813
+ #: src/Admin/Pages/TestTab.php:603
814
  msgid "Check the emails that are sending are sending individually. Example: email is not sending to 30 recipients. You can install any WordPress e-mail logging plugin to do that."
815
  msgstr ""
816
 
817
+ #: src/Admin/Pages/TestTab.php:604
818
  msgid "Contact your SMTP host to ask about sending/rate limits."
819
  msgstr ""
820
 
821
+ #: src/Admin/Pages/TestTab.php:605
822
  msgid "Verify with them your SMTP account is in good standing and your account has not been flagged."
823
  msgstr ""
824
 
825
+ #: src/Admin/Pages/TestTab.php:615
826
  msgid "Unauthenticated senders are not allowed."
827
  msgstr ""
828
 
829
+ #: src/Admin/Pages/TestTab.php:616
830
  msgid "This means the connection to your SMTP host was made successfully, but you should enable Authentication and provide correct Username and Password."
831
  msgstr ""
832
 
833
+ #: src/Admin/Pages/TestTab.php:619
834
  msgid "Go to WP Mail SMTP plugin Settings page."
835
  msgstr ""
836
 
837
+ #: src/Admin/Pages/TestTab.php:620
838
  msgid "Enable Authentication"
839
  msgstr ""
840
 
841
+ #: src/Admin/Pages/TestTab.php:621
842
  msgid "Enter correct SMTP Username (usually this is an email address) and Password in the appropriate fields."
843
  msgstr ""
844
 
845
+ #: src/Admin/Pages/TestTab.php:631
846
  msgid "Could not connect to the SMTP host."
847
  msgstr ""
848
 
849
+ #: src/Admin/Pages/TestTab.php:639
850
+ #: src/Admin/Pages/TestTab.php:975
851
  msgid "Typically this error is returned for one of the following reasons:"
852
  msgstr ""
853
 
854
+ #: src/Admin/Pages/TestTab.php:640
855
  msgid "SMTP settings are incorrect (wrong port, security setting, incorrect host)."
856
  msgstr ""
857
 
858
+ #: src/Admin/Pages/TestTab.php:641
859
+ #: src/Admin/Pages/TestTab.php:977
860
  msgid "Your web server is blocking the connection."
861
  msgstr ""
862
 
863
+ #: src/Admin/Pages/TestTab.php:642
864
  msgid "Your SMTP host is rejecting the connection."
865
  msgstr ""
866
 
867
+ #: src/Admin/Pages/TestTab.php:645
868
  msgid "Triple check your SMTP settings including host address, email, and password, port, and security."
869
  msgstr ""
870
 
871
  #. translators: %1$s - SMTP host address, %2$s - SMTP port, %3$s - SMTP encryption.
872
+ #: src/Admin/Pages/TestTab.php:649
873
  msgid "Contact your web hosting provider and ask them to verify your server can connect to %1$s on port %2$s using %3$s encryption. Additionally, ask them if a firewall or security policy may be preventing the connection - many shared hosts block certain ports.<br><strong>Note: this is the most common cause of this issue.</strong>"
874
  msgstr ""
875
 
876
+ #: src/Admin/Pages/TestTab.php:662
877
  msgid "no"
878
  msgstr ""
879
 
880
+ #: src/Admin/Pages/TestTab.php:675
881
+ #: src/Admin/Pages/TestTab.php:690
882
+ #: src/Admin/Pages/TestTab.php:706
883
  msgid "Mailgun failed."
884
  msgstr ""
885
 
886
+ #: src/Admin/Pages/TestTab.php:676
887
  msgid "It seems that you forgot to activate your Mailgun account."
888
  msgstr ""
889
 
890
+ #: src/Admin/Pages/TestTab.php:679
891
  msgid "Check your inbox you used to create a Mailgun account. Click the activation link in an email from Mailgun."
892
  msgstr ""
893
 
894
+ #: src/Admin/Pages/TestTab.php:680
895
  msgid "If you do not see activation email, go to your Mailgun control panel and resend the activation email."
896
  msgstr ""
897
 
898
+ #: src/Admin/Pages/TestTab.php:691
899
  msgid "Typically this error is because there is an issue with your Mailgun settings, in many cases the API key."
900
  msgstr ""
901
 
902
+ #: src/Admin/Pages/TestTab.php:694
903
  msgid "Verify your API key is correct."
904
  msgstr ""
905
 
906
+ #: src/Admin/Pages/TestTab.php:695
907
  msgid "Go to your Mailgun account and view your API key."
908
  msgstr ""
909
 
910
+ #: src/Admin/Pages/TestTab.php:696
911
  msgid "Note that the API key includes the \"key\" prefix, so make sure that it is in the WP Mail SMTP Mailgun API setting."
912
  msgstr ""
913
 
914
+ #: src/Admin/Pages/TestTab.php:707
915
  msgid "Your Mailgun account does not have access to send emails."
916
  msgstr ""
917
 
918
+ #: src/Admin/Pages/TestTab.php:708
919
  msgid "Typically this error is because you have not set up and/or complete domain name verification for your Mailgun account."
920
  msgstr ""
921
 
922
  #. translators: %s - Mailgun documentation URL.
923
+ #: src/Admin/Pages/TestTab.php:714
924
  msgid "Go to our how-to guide for setting up <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">Mailgun with WP Mail SMTP</a>."
925
  msgstr ""
926
 
927
+ #: src/Admin/Pages/TestTab.php:725
928
  msgid "Complete the steps in section \"2. Verify Your Domain\"."
929
  msgstr ""
930
 
931
+ #: src/Admin/Pages/TestTab.php:735
932
+ #: src/Admin/Pages/TestTab.php:786
933
+ #: src/Admin/Pages/TestTab.php:807
934
+ #: src/Admin/Pages/TestTab.php:834
935
+ #: src/Admin/Pages/TestTab.php:850
936
+ #: src/Admin/Pages/TestTab.php:905
937
+ #: src/Admin/Pages/TestTab.php:932
938
  msgid "Google API Error."
939
  msgstr ""
940
 
941
+ #: src/Admin/Pages/TestTab.php:736
942
  msgid "You have not properly configured Gmail mailer."
943
  msgstr ""
944
 
945
+ #: src/Admin/Pages/TestTab.php:737
946
  msgid "Make sure that you have clicked the \"Allow plugin to send emails using your Google account\" button under Gmail settings."
947
  msgstr ""
948
 
949
+ #: src/Admin/Pages/TestTab.php:740
950
  msgid "Go to plugin Settings page and click the \"Allow plugin to send emails using your Google account\" button."
951
  msgstr ""
952
 
953
+ #: src/Admin/Pages/TestTab.php:741
954
  msgid "After the click you should be redirected to a Gmail authorization screen, where you will be asked a permission to send emails on your behalf."
955
  msgstr ""
956
 
957
+ #: src/Admin/Pages/TestTab.php:742
958
  msgid "Please click \"Agree\", if you see that button. If not - you will need to enable less secure apps first:"
959
  msgstr ""
960
 
961
  #. translators: %s - Google support article URL.
962
+ #: src/Admin/Pages/TestTab.php:748
963
  msgid "if you are using regular Gmail account, please <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">read this article</a> to proceed."
964
  msgstr ""
965
 
966
  #. translators: %s - Google support article URL.
967
+ #: src/Admin/Pages/TestTab.php:764
968
  msgid "if you are using G Suite, please <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">read this article</a> to proceed."
969
  msgstr ""
970
 
971
+ #: src/Admin/Pages/TestTab.php:787
972
  msgid "Typically this error is because address the email was sent to is invalid or was empty."
973
  msgstr ""
974
 
975
+ #: src/Admin/Pages/TestTab.php:790
976
  msgid "Check the \"Send To\" email address used and confirm it is a valid email and was not empty."
977
  msgstr ""
978
 
979
  #. translators: 1 - correct email address example. 2 - incorrect email address example.
980
+ #: src/Admin/Pages/TestTab.php:793
981
  msgid "It should be something like this: %1$s. These are incorrect values: %2$s."
982
  msgstr ""
983
 
984
+ #: src/Admin/Pages/TestTab.php:797
985
  msgid "Make sure that the generated email has a TO header, useful when you are responsible for email creation."
986
  msgstr ""
987
 
988
+ #: src/Admin/Pages/TestTab.php:808
989
  msgid "Unfortunately, this error can be due to many different reasons."
990
  msgstr ""
991
 
992
  #. translators: %s - Blog article URL.
993
+ #: src/Admin/Pages/TestTab.php:814
994
  msgid "Please <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">read this article</a> to learn more about what can cause this error and how it can be resolved."
995
  msgstr ""
996
 
997
+ #: src/Admin/Pages/TestTab.php:835
998
  msgid "Authentication code that Google returned to you has already been used on your previous auth attempt."
999
  msgstr ""
1000
 
1001
+ #: src/Admin/Pages/TestTab.php:838
1002
  msgid "Make sure that you are not trying to manually clean up the plugin options to retry the \"Allow...\" step."
1003
  msgstr ""
1004
 
1005
+ #: src/Admin/Pages/TestTab.php:839
1006
  msgid "Reinstall the plugin with clean plugin data turned on on Misc page. This will remove all the plugin options and you will be safe to retry."
1007
  msgstr ""
1008
 
1009
+ #: src/Admin/Pages/TestTab.php:840
1010
  msgid "Make sure there is no aggressive caching on site admin area pages or try to clean cache between attempts."
1011
  msgstr ""
1012
 
1013
+ #: src/Admin/Pages/TestTab.php:851
1014
  msgid "There are various reasons for that, please review the steps below."
1015
  msgstr ""
1016
 
1017
  #. translators: %s - Google G Suite Admin area URL.
1018
+ #: src/Admin/Pages/TestTab.php:857
1019
  msgid "Make sure that your G Suite trial period has not expired. You can check the status <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>."
1020
  msgstr ""
1021
 
1022
  #. translators: %s - Google G Suite Admin area URL.
1023
+ #: src/Admin/Pages/TestTab.php:871
1024
  msgid "Make sure that Gmail app in your G Suite is actually enabled. You can check that in Apps list in <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">G Suite Admin</a> area."
1025
  msgstr ""
1026
 
1027
  #. translators: %s - Google Developers Console URL.
1028
+ #: src/Admin/Pages/TestTab.php:885
1029
  msgid "Make sure that you have Gmail API enabled, and you can do that <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>."
1030
  msgstr ""
1031
 
1032
+ #: src/Admin/Pages/TestTab.php:908
1033
+ #: src/Admin/Pages/TestTab.php:936
1034
  msgid "Make sure that the used Client ID/Secret correspond to a proper project that has Gmail API enabled."
1035
  msgstr ""
1036
 
1037
  #. translators: %s - WPForms.com tutorial URL.
1038
+ #: src/Admin/Pages/TestTab.php:912
1039
  msgid "Please follow our <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">Gmail tutorial</a> to be sure that all the correct project and data is applied."
1040
  msgstr ""
1041
 
1042
+ #: src/Admin/Pages/TestTab.php:933
1043
  msgid "You may have added a new API to a project"
1044
  msgstr ""
1045
 
1046
+ #: src/Admin/Pages/TestTab.php:937
1047
  msgid "Try to use a separate project for your emails, so the project has only 1 Gmail API in it enabled. You will need to remove the old project and create a new one from scratch."
1048
  msgstr ""
1049
 
1050
+ #: src/Admin/Pages/TestTab.php:973
1051
  msgid "An issue was detected."
1052
  msgstr ""
1053
 
1054
+ #: src/Admin/Pages/TestTab.php:974
1055
  msgid "This means your test email was unable to be sent."
1056
  msgstr ""
1057
 
1058
+ #: src/Admin/Pages/TestTab.php:976
1059
  msgid "Plugin settings are incorrect (wrong SMTP settings, invalid Mailer configuration, etc)."
1060
  msgstr ""
1061
 
1062
+ #: src/Admin/Pages/TestTab.php:978
1063
  msgid "Your host is rejecting the connection."
1064
  msgstr ""
1065
 
1066
+ #: src/Admin/Pages/TestTab.php:981
1067
  msgid "Triple check the plugin settings, consider reconfiguring to make sure everything is correct (eg bad copy and paste)."
1068
  msgstr ""
1069
 
1070
+ #: src/Admin/Pages/TestTab.php:983
1071
  msgid "Contact your web hosting provider and ask them to verify your server can make outside connections. Additionally, ask them if a firewall or security policy may be preventing the connection - many shared hosts block certain ports.<br><strong>Note: this is the most common cause of this issue.</strong>"
1072
  msgstr ""
1073
 
1074
+ #: src/Admin/Pages/TestTab.php:989
1075
  msgid "Try using a different mailer."
1076
  msgstr ""
1077
 
1078
+ #: src/Admin/Pages/TestTab.php:1008
1079
  msgid "There was a problem while sending the test email."
1080
  msgstr ""
1081
 
1082
+ #: src/Admin/Pages/TestTab.php:1018
1083
  msgid "Recommended next steps:"
1084
  msgstr ""
1085
 
1086
+ #: src/Admin/Pages/TestTab.php:1028
1087
  msgid "Need support?"
1088
  msgstr ""
1089
 
1090
  #. translators: %s - WPMailSMTP.com account area link.
1091
+ #: src/Admin/Pages/TestTab.php:1036
1092
  msgid "As a WP Mail SMTP Pro user you have access to WP Mail SMTP priority support. Please log in to your WPMailSMTP.com account and <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">submit a support ticket</a>."
1093
  msgstr ""
1094
 
1095
+ #: src/Admin/Pages/TestTab.php:1053
1096
  msgid "WP Mail SMTP is a free plugin, and the team behind WPForms maintains it to give back to the WordPress community."
1097
  msgstr ""
1098
 
1099
  #. translators: %s - WPMailSMTP.com URL.
1100
+ #: src/Admin/Pages/TestTab.php:1060
1101
  msgid "To access our world class support, please <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">upgrade to WP Mail SMTP Pro</a>. Along with getting expert support, you will also get Notification controls, Email Logging, and integrations for Amazon SES, Office 365, and Outlook.com."
1102
  msgstr ""
1103
 
1104
+ #: src/Admin/Pages/TestTab.php:1075
1105
  msgid "Additionally, you can take advantage of our White Glove Setup. Sit back and relax while we handle everything for you! If you simply don't have time or maybe you feel a bit in over your head - we got you covered."
1106
  msgstr ""
1107
 
1108
+ #: src/Admin/Pages/TestTab.php:1081
1109
  msgid "As a valued WP Mail SMTP user, you will get <span class=\"price-off\">20% off regular pricing</span>, automatically applied at checkout!"
1110
  msgstr ""
1111
 
1112
  #. translators: %1$s - WP Mail SMTP support policy URL, %2$s - WP Mail SMTP support forum URL, %3$s - WPMailSMTP.com URL.
1113
+ #: src/Admin/Pages/TestTab.php:1095
1114
  msgid "Alternatively, we also offer <a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">limited support</a> on the WordPress.org support forums. You can <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">create a support thread</a> there, but please understand that free support is not guaranteed and is limited to simple issues. If you have an urgent or complex issue, then please consider <a href=\"%3$s\" target=\"_blank\" rel=\"noopener noreferrer\">upgrading to WP Mail SMTP Pro</a> to access our priority support ticket system."
1115
  msgstr ""
1116
 
1117
+ #: src/Admin/Pages/TestTab.php:1116
1118
  msgid "Click here to view the full Error Log for debugging"
1119
  msgstr ""
1120
 
1121
+ #: src/Admin/Pages/TestTab.php:1125
1122
  msgid "Please copy only the content of the error debug message above, identified with an orange left border, into the support forum topic if you experience any issues."
1123
  msgstr ""
1124
 
1138
  msgstr ""
1139
 
1140
  #. translators: %1$s - WP Mail SMTP plugin name; %2$s - WPForms.com URL to a related doc.
1141
+ #: src/Core.php:366
1142
  msgid "Your site is running an outdated version of PHP that is no longer supported and may cause issues with %1$s. <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">Read more</a> for additional information."
1143
  msgstr ""
1144
 
1145
+ #: src/Core.php:380
1146
  msgid "<strong>Please Note:</strong> Support for PHP 5.3-5.5 will be discontinued in 2019. After this, if no further action is taken, WP Mail SMTP functionality will be disabled."
1147
  msgstr ""
1148
 
1149
  #. translators: %1$s - plugin name and its version, %2$s - plugin Misc settings page.
1150
+ #: src/Core.php:420
1151
  msgid "<strong>EMAILING DISABLED:</strong> The %1$s is currently blocking all emails from being sent. To send emails, go to plugin <a href=\"%2$s\">Misc settings</a> and disable the \"Do Not Send\" option."
1152
  msgstr ""
1153
 
1154
  #. translators: %s - plugin name and its version.
1155
+ #: src/Core.php:451
1156
  msgid "<strong>EMAIL DELIVERY ERROR:</strong> the plugin %s logged this error during the last time it tried to send an email:"
1157
  msgstr ""
1158
 
1159
+ #: src/Core.php:481
1160
  msgid "Consider running an email test after fixing it."
1161
  msgstr ""
1162
 
1168
  msgid "Gmail"
1169
  msgstr ""
1170
 
1171
+ #. translators: %s - URL to our Gmail doc.
1172
+ #: src/Providers/Gmail/Options.php:35
1173
+ msgid "Send emails using your Gmail or G Suite (formerly Google Apps) account, all while keeping your login credentials safe. Other Google SMTP methods require enabling less secure apps in your account and entering your password. However, this integration uses the Google API to improve email delivery issues while keeping your site secure.<br><br>Read our <a href=\"%s\" target=\"_blank\" rel=\"noopener noreferrer\">Gmail documentation</a> to learn how to configure Gmail or G Suite."
1174
+ msgstr ""
1175
+
1176
+ #: src/Providers/Gmail/Options.php:48
1177
+ msgid "The Gmail mailer works well for sites that send low numbers of emails. However, Gmail's API has rate limitations and a number of additional restrictions that can lead to challenges during setup. If you expect to send a high volume of emails, or if you find that your web host is not compatible with the Gmail API restrictions, then we recommend considering a different mailer option."
1178
  msgstr ""
1179
 
1180
+ #: src/Providers/Gmail/Options.php:72
1181
  msgid "Client ID"
1182
  msgstr ""
1183
 
1184
+ #: src/Providers/Gmail/Options.php:87
1185
  msgid "Client Secret"
1186
  msgstr ""
1187
 
1188
+ #: src/Providers/Gmail/Options.php:109
1189
  msgid "Authorized redirect URI"
1190
  msgstr ""
1191
 
1192
+ #: src/Providers/Gmail/Options.php:117
1193
  msgid "Copy URL to clipboard"
1194
  msgstr ""
1195
 
1196
+ #: src/Providers/Gmail/Options.php:122
1197
  msgid "Please copy this URL into the \"Authorized redirect URIs\" field of your Google web application."
1198
  msgstr ""
1199
 
1200
+ #: src/Providers/Gmail/Options.php:131
1201
  msgid "Authorization"
1202
  msgstr ""
1203
 
1204
+ #: src/Providers/Gmail/Options.php:159
1205
  msgid "Allow plugin to send emails using your Google account"
1206
  msgstr ""
1207
 
1208
+ #: src/Providers/Gmail/Options.php:162
1209
  msgid "Click the button above to confirm authorization."
1210
  msgstr ""
1211
 
1212
+ #: src/Providers/Gmail/Options.php:168
1213
  msgid "Remove Connection"
1214
  msgstr ""
1215
 
1216
  #. translators: %s - email address, as received from Google API.
1217
+ #: src/Providers/Gmail/Options.php:177
1218
  msgid "Connected as %s"
1219
  msgstr ""
1220
 
1221
+ #: src/Providers/Gmail/Options.php:184
1222
  msgid "Removing the connection will give you an ability to redo the connection or link to another Google account."
1223
  msgstr ""
1224
 
1225
+ #: src/Providers/Gmail/Options.php:192
1226
  msgid "You need to save settings with Client ID and Client Secret before you can proceed."
1227
  msgstr ""
1228
 
1294
  msgid "<a href=\"%s\" rel=\"\" target=\"_blank\">More information</a> on Mailgun.com."
1295
  msgstr ""
1296
 
1297
+ #: src/Providers/OptionsAbstract.php:177
1298
  #: wp-mail-smtp-0.11.2.php:376
1299
  msgid "SMTP Host"
1300
  msgstr ""
1301
 
1302
+ #: src/Providers/OptionsAbstract.php:191
1303
  #: wp-mail-smtp-0.11.2.php:391
1304
  #: wp-mail-smtp-0.11.2.php:395
1305
  #: wp-mail-smtp-0.11.2.php:510
1307
  msgid "Encryption"
1308
  msgstr ""
1309
 
1310
+ #: src/Providers/OptionsAbstract.php:201
1311
  msgid "None"
1312
  msgstr ""
1313
 
1314
+ #: src/Providers/OptionsAbstract.php:210
1315
  msgid "SSL"
1316
  msgstr ""
1317
 
1318
+ #: src/Providers/OptionsAbstract.php:219
1319
  msgid "TLS"
1320
  msgstr ""
1321
 
1322
+ #: src/Providers/OptionsAbstract.php:223
1323
  msgid "For most servers TLS is the recommended option. If your SMTP provider offers both SSL and TLS options, we recommend using TLS."
1324
  msgstr ""
1325
 
1326
+ #: src/Providers/OptionsAbstract.php:231
1327
  #: wp-mail-smtp-0.11.2.php:384
1328
  #: wp-mail-smtp-0.11.2.php:502
1329
  msgid "SMTP Port"
1330
  msgstr ""
1331
 
1332
+ #: src/Providers/OptionsAbstract.php:245
1333
  msgid "Auto TLS"
1334
  msgstr ""
1335
 
1336
+ #: src/Providers/OptionsAbstract.php:259
1337
  msgid "By default TLS encryption is automatically used if the server supports it, which is recommended. In some cases, due to server misconfigurations, this can cause issues and may need to be disabled."
1338
  msgstr ""
1339
 
1340
+ #: src/Providers/OptionsAbstract.php:267
1341
  #: wp-mail-smtp-0.11.2.php:418
1342
  #: wp-mail-smtp-0.11.2.php:422
1343
  msgid "Authentication"
1344
  msgstr ""
1345
 
1346
+ #: src/Providers/OptionsAbstract.php:286
1347
  msgid "SMTP Username"
1348
  msgstr ""
1349
 
1350
+ #: src/Providers/OptionsAbstract.php:300
1351
  msgid "SMTP Password"
1352
  msgstr ""
1353
 
1354
  #. translators: %s - constant name: WPMS_SMTP_PASS.
1355
+ #: src/Providers/OptionsAbstract.php:312
1356
  msgid "To change the password you need to change the value of the constant there: %s"
1357
  msgstr ""
1358
 
1359
  #. translators: %1$s - wp-config.php file, %2$s - WPMS_ON constant name.
1360
+ #: src/Providers/OptionsAbstract.php:320
1361
  msgid "If you want to disable the use of constants, find in %1$s file the constant %2$s and turn if off:"
1362
  msgstr ""
1363
 
1364
+ #: src/Providers/OptionsAbstract.php:330
1365
  msgid "All the defined constants will stop working and you will be able to change all the values on this page."
1366
  msgstr ""
1367
 
1368
+ #: src/Providers/OptionsAbstract.php:338
1369
  msgid "The password is stored in plain text. We highly recommend you set up your password in your WordPress configuration file for improved security."
1370
  msgstr ""
1371
 
1372
  #. translators: %s - wp-config.php.
1373
+ #: src/Providers/OptionsAbstract.php:343
1374
  msgid "To do this add the lines below to your %s file:"
1375
  msgstr ""
1376
 
1377
  #. translators: %1$s - Provider name; %2$s - PHP version required by Provider; %3$s - current PHP version.
1378
+ #: src/Providers/OptionsAbstract.php:396
1379
  msgid "%1$s requires PHP %2$s to work and does not support your current PHP version %3$s. Please contact your host and request a PHP upgrade to the latest one."
1380
  msgstr ""
1381
 
1382
+ #: src/Providers/OptionsAbstract.php:403
1383
+ #: src/Providers/OptionsAbstract.php:427
1384
+ msgid "Meanwhile you can switch to some other mailers."
1385
  msgstr ""
1386
 
1387
  #. translators: %s - Provider name.
1388
+ #: src/Providers/OptionsAbstract.php:422
1389
  msgid "%s requires a SSL certificate on a site to work and does not support you current installation. Please contact your host and request a SSL certificate or install a free one, like Let's Encrypt."
1390
  msgstr ""
1391
 
1392
  #. translators: %1$s - constant name, %2$s - file name.
1393
+ #: src/Providers/OptionsAbstract.php:446
1394
  msgid "The value of this field was set using a constant %1$s most likely inside %2$s of your WordPress installation."
1395
  msgstr ""
1396
 
1408
  msgstr ""
1409
 
1410
  #: src/Providers/Sendgrid/Options.php:57
1411
+ #: src/Providers/Sendinblue/Options.php:88
1412
  msgid "API Key"
1413
  msgstr ""
1414
 
1426
  msgid "To send emails you will need only a %s access level for this API key."
1427
  msgstr ""
1428
 
1429
+ #. translators: %1$s - URL to sendinblue.com site.
1430
+ #: src/Providers/Sendinblue/Options.php:31
1431
+ msgid "<strong><a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">Sendinblue</a> is our recommended transactional email service.</strong> Founded in 2012, they serve 80,000+ growing companies around the world and send over 30 million emails each day. They understand that transactional emails are the heart of your customer relationships. Their email deliverability experts are constantly at work optimizing the reliability and speed of their SMTP infrastructure. Sendinblue provides users 300 free emails per day."
1432
+ msgstr ""
1433
+
1434
+ #. translators: %2$s - URL to wpmailsmtp.com doc.
1435
+ #: src/Providers/Sendinblue/Options.php:34
1436
+ msgid "Read our <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">Sendinblue documentation</a> to learn how to configure Sendinblue and improve your email deliverability."
1437
+ msgstr ""
1438
+
1439
+ #: src/Providers/Sendinblue/Options.php:53
1440
+ msgid "Get Sendinblue Now (Free)"
1441
+ msgstr ""
1442
+
1443
+ #: src/Providers/Sendinblue/Options.php:61
1444
+ msgid "Sendinblue"
1445
+ msgstr ""
1446
+
1447
+ #. translators: %s - sendinblue.com link to get an API Key.
1448
+ #: src/Providers/Sendinblue/Options.php:107
1449
+ msgid "Follow this link to get an API Key: %s."
1450
+ msgstr ""
1451
+
1452
+ #: src/Providers/Sendinblue/Options.php:109
1453
+ msgid "Get v3 API Key"
1454
+ msgstr ""
1455
+
1456
  #: src/Providers/SMTP/Options.php:25
1457
  msgid "Other SMTP"
1458
  msgstr ""
1612
  msgid "Your site is running an outdated version of PHP that is no longer supported and may cause issues with %1$s. %2$sRead more%3$s for additional information."
1613
  msgstr ""
1614
 
1615
+ #: wp_mail_smtp.php:128
1616
  msgid "Please deactivate the free version of the WP Mail SMTP plugin before activating WP Mail SMTP Pro."
1617
  msgstr ""
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: wpforms, jaredatch, smub, slaFFik
3
  Tags: smtp, wp mail smtp, wordpress smtp, gmail smtp, sendgrid smtp, mailgun smtp, mail, mailer, phpmailer, wp_mail, email, mailgun, sengrid, gmail, wp smtp
4
  Requires at least: 4.9
5
  Tested up to: 5.2
6
- Stable tag: 1.5.2
7
  Requires PHP: 5.3
8
 
9
  The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 1 million sites.
@@ -42,17 +42,28 @@ This helps you fix all WordPress not sending email issues.
42
 
43
  WP Mail SMTP plugin includes many different SMTP setup options:
44
 
45
- 1. Mailgun SMTP
46
- 2. SendGrid SMTP
47
- 3. Gmail SMTP
48
- 4. Microsoft SMTP (Outlook.com and Office 365) <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">[Pro]</a>
49
- 5. Amazon SES SMTP <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">[Pro]</a>
50
- 4. All Other SMTP
 
51
 
52
  For all options, you can specify the "from name" and "email address" for outgoing emails.
53
 
54
  Instead of having users use different SMTP plugins and workflows for different SMTP providers, we decided to bring it all in one. This is what makes WP Mail SMTP, the best SMTP solution for WordPress.
55
 
 
 
 
 
 
 
 
 
 
 
56
  = Mailgun SMTP =
57
 
58
  Mailgun SMTP is a popular SMTP service provider that allows you to send large quantities of emails. They allow you to send your first 10,000 emails for free every month.
@@ -61,6 +72,12 @@ WP Mail SMTP plugin offers a native integration with MailGun. All you have to do
61
 
62
  Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-mailgun-mailer-in-wp-mail-smtp/" rel="friend">Mailgun documentation</a> for more details.
63
 
 
 
 
 
 
 
64
  = Gmail SMTP =
65
 
66
  Often bloggers and small business owners don't want to use third-party SMTP services. Well you can use your Gmail or G Suite account for SMTP emails.
@@ -71,12 +88,6 @@ Unlike other Gmail SMTP plugins, our Gmail SMTP option uses OAuth to authenticat
71
 
72
  Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/" rel="friend">Gmail documentation</a> for more details.
73
 
74
- = SendGrid SMTP =
75
-
76
- SendGrid has a free SMTP plan that you can use to send up to 100 emails per day. With our native SendGrid SMTP integration, you can easily and securely set up SendGrid SMTP on your WordPress site.
77
-
78
- Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-sendgrid-mailer-in-wp-mail-smtp/" rel="friend">SendGrid documentation</a> for more details.
79
-
80
  = Microsoft SMTP (Outlook.com and Office 365) =
81
 
82
  Many business use Outlook.com or Office 365 to their to power their email. For those users, the Microsoft mailer can be a great option. This integration allows you to use your existing Outlook.com or Office 365 account to send your emails reliably.
@@ -197,6 +208,13 @@ By all means please contact us to discuss features or options you'd like to see
197
 
198
  == Changelog ==
199
 
 
 
 
 
 
 
 
200
  = 1.5.2 - 2019-07-18 =
201
  * Fixed: "Redirect URI mismatch" error for "Gmail" mailer when trying to re-authorize an account that was initially created with version < v1.5.0.
202
  * Changed: Make "Authentication" setting in "Other SMTP" mailer ON by default for new users.
@@ -344,116 +362,3 @@ By all means please contact us to discuss features or options you'd like to see
344
  * Changed: SMTP password field does not display real password at all when using constants in `wp-config.php` to define it.
345
  * Changed: Escape properly all translations.
346
  * Changed: More helpful test email content (with a mailer name).
347
-
348
- = 0.11.2 - 2017-11-28 =
349
- * Added: Setting to hide announcement feed.
350
- * Changed: Announcement feed data.
351
-
352
- = 0.11.1 - 2017-10-30 =
353
- * Fixed: Older PHP compatibility fix.
354
-
355
- = 0.11 - 2017-10-30 =
356
- * Added: Helper description to Return Path option.
357
- * Added: Filter `wp_mail_smtp_admin_test_email_smtp_debug` to increase the debug message verbosity.
358
- * Added: PHP 5.2 notice.
359
- * Added: Announcement feed.
360
- * Changed: Localization fixes, proper locale name.
361
- * Changed: Code style improvements and optimizations for both HTML and PHP.
362
- * Changed: Inputs for emails now have a proper type `email`, instead of a generic `text`.
363
- * Changed: Turn off `$phpmailer->SMTPAutoTLS` when `No encryption` option is set to prevent error while sending emails.
364
- * Changed: Hide Pepipost for those who are not using it.
365
- * Changed: WP CLI support improved.
366
-
367
- = 0.10.1 =
368
- * Addition of Pepipost and cleanup of admin page.
369
-
370
- = 0.10.0 =
371
- * Addition of Pepipost and cleanup of admin page.
372
-
373
- = 0.9.6 =
374
- * Minor security fix, sanitize test email address.
375
-
376
- = 0.9.5 =
377
- * Minor security fix, hat tip JD Grimes.
378
-
379
- = 0.9.4 =
380
- * Improvement to the test email function, very low priority update.
381
-
382
- = 0.9.3 =
383
- * Fixing reported issue with passing by reference. props Adam Conway
384
-
385
- = 0.9.2 =
386
- * Removing the deprecation notice.
387
-
388
- = 0.9.1 =
389
- * $phpmailer->language became protected in WP 3.2, no longer unset on debug output.
390
-
391
- = 0.9.0 =
392
- * Typo in the From email description.
393
- * Removed changelog from plugin file, no need to duplicate it.
394
- * Optionally set $phpmailer->Sender from from email, helps with sendmail / mail().
395
-
396
- = 0.8.7 =
397
- * Fix for a long standing bug that caused an error during plugin activation.
398
-
399
- = 0.8.6 =
400
- * The Settings link really does work this time, promise. Apologies for the unnecessary updates.
401
-
402
- = 0.8.5 =
403
- * Bugfix, the settings link on the Plugin page was broken by 0.8.4.
404
-
405
- = 0.8.4 =
406
- * Minor bugfix, remove use of esc_html() to improve backwards compatibility.
407
- * Removed second options page menu props ovidiu.
408
-
409
- = 0.8.3 =
410
- * Bugfix, return WPMS_MAIL_FROM_NAME, props nacin.
411
- * Add Settings link, props Mike Challis http://profiles.wordpress.org/MikeChallis/
412
-
413
- = 0.8.2 =
414
- * Bugfix, call phpmailer_init_smtp() correctly, props Sinklar.
415
-
416
- = 0.8.1 =
417
- * Internationalisation improvements.
418
-
419
- = 0.8 =
420
- * Added port, SSL/TLS, option whitelisting, validate_email(), and constant options.
421
-
422
- = 0.7 =
423
- * Added checks to only override the default from name / email
424
-
425
- = 0.6 =
426
- * Added additional SMTP debugging output
427
-
428
- = 0.5.2 =
429
- * Fixed a pre 2.3 bug to do with mail from
430
-
431
- = 0.5.1 =
432
- * Added a check to display a warning on versions prior to 2.3
433
-
434
- = 0.5.0 =
435
- * Upgraded to match 2.3 filters which add a second filter for from name
436
-
437
- = 0.4.2 =
438
- * Fixed a bug in 0.4.1 and added more debugging output
439
-
440
- = 0.4.1 =
441
- * Added $phpmailer->ErroInfo to the test mail output
442
-
443
- = 0.4 =
444
- * Added the test email feature and cleaned up some other bits and pieces
445
-
446
- = 0.3.2 =
447
- * Changed to use register_activation_hook for greater compatability
448
-
449
- = 0.3.1 =
450
- * Added readme for WP-Plugins.org compatability
451
-
452
- = 0.3 =
453
- * Various bugfixes and added From options
454
-
455
- = 0.2 =
456
- * Reworked approach as suggested by westi, added options page
457
-
458
- = 0.1 =
459
- * Initial approach, copying the wp_mail function and replacing it
3
  Tags: smtp, wp mail smtp, wordpress smtp, gmail smtp, sendgrid smtp, mailgun smtp, mail, mailer, phpmailer, wp_mail, email, mailgun, sengrid, gmail, wp smtp
4
  Requires at least: 4.9
5
  Tested up to: 5.2
6
+ Stable tag: 1.6.0
7
  Requires PHP: 5.3
8
 
9
  The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 1 million sites.
42
 
43
  WP Mail SMTP plugin includes many different SMTP setup options:
44
 
45
+ 1. Sendinblue SMTP <strong>(Recommended)</strong>
46
+ 2. Mailgun SMTP
47
+ 3. SendGrid SMTP
48
+ 4. Gmail SMTP
49
+ 5. Microsoft SMTP (Outlook.com and Office 365) <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">[Pro]</a>
50
+ 6. Amazon SES SMTP <a href="https://wpmailsmtp.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion&utm_content=readme" rel="friend">[Pro]</a>
51
+ 7. All Other SMTP
52
 
53
  For all options, you can specify the "from name" and "email address" for outgoing emails.
54
 
55
  Instead of having users use different SMTP plugins and workflows for different SMTP providers, we decided to bring it all in one. This is what makes WP Mail SMTP, the best SMTP solution for WordPress.
56
 
57
+ = Sendinblue SMTP =
58
+
59
+ Sendinblue is our recommended transactional email service.
60
+
61
+ They serve 80,000+ growing companies around the world and send over 30 million emails each day.
62
+
63
+ Their email deliverability experts are constantly at work optimizing the reliability and speed of their SMTP infrastructure. Sendinblue provides users 300 free emails per day.
64
+
65
+ Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-sendinblue-mailer-in-wp-mail-smtp/" rel="friend">Sendinblue documentation</a> for more details.
66
+
67
  = Mailgun SMTP =
68
 
69
  Mailgun SMTP is a popular SMTP service provider that allows you to send large quantities of emails. They allow you to send your first 10,000 emails for free every month.
72
 
73
  Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-mailgun-mailer-in-wp-mail-smtp/" rel="friend">Mailgun documentation</a> for more details.
74
 
75
+ = SendGrid SMTP =
76
+
77
+ SendGrid has a free SMTP plan that you can use to send up to 100 emails per day. With our native SendGrid SMTP integration, you can easily and securely set up SendGrid SMTP on your WordPress site.
78
+
79
+ Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-sendgrid-mailer-in-wp-mail-smtp/" rel="friend">SendGrid documentation</a> for more details.
80
+
81
  = Gmail SMTP =
82
 
83
  Often bloggers and small business owners don't want to use third-party SMTP services. Well you can use your Gmail or G Suite account for SMTP emails.
88
 
89
  Read our <a href="https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/" rel="friend">Gmail documentation</a> for more details.
90
 
 
 
 
 
 
 
91
  = Microsoft SMTP (Outlook.com and Office 365) =
92
 
93
  Many business use Outlook.com or Office 365 to their to power their email. For those users, the Microsoft mailer can be a great option. This integration allows you to use your existing Outlook.com or Office 365 account to send your emails reliably.
208
 
209
  == Changelog ==
210
 
211
+ = 1.6.0 - 2019-08-21 =
212
+ * Added: New transactional mailer: Sendinblue.
213
+ * Added: Educate users to use transactional mailers for better deliverability.
214
+ * Added: New option and filter to disable admin area delivery error notices.
215
+ * Changed: Hide private API key saved in the DB for API based mailers using `input[type=password]`.
216
+ * Changed: Update links to various docs, pointing now to https://wpmailsmtp.com.
217
+
218
  = 1.5.2 - 2019-07-18 =
219
  * Fixed: "Redirect URI mismatch" error for "Gmail" mailer when trying to re-authorize an account that was initially created with version < v1.5.0.
220
  * Changed: Make "Authentication" setting in "Other SMTP" mailer ON by default for new users.
362
  * Changed: SMTP password field does not display real password at all when using constants in `wp-config.php` to define it.
363
  * Changed: Escape properly all translations.
364
  * Changed: More helpful test email content (with a mailer name).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/Admin/Area.php CHANGED
@@ -154,7 +154,7 @@ class Area {
154
  public function display_setup_notice() {
155
 
156
  // Bail if we're not on a plugin page.
157
- if ( ! $this->is_admin_page() ) {
158
  return;
159
  }
160
 
@@ -179,7 +179,7 @@ class Area {
179
  'strong' => array(),
180
  )
181
  ),
182
- '#wp-mail-smtp-setting-row-mailer'
183
  ),
184
  WP::ADMIN_NOTICE_INFO
185
  );
@@ -233,7 +233,7 @@ class Area {
233
  * Enqueue admin area scripts and styles.
234
  *
235
  * @since 1.0.0
236
- * @since 1.5.0 Added ajax tasks for plugin installation/activation.
237
  *
238
  * @param string $hook
239
  */
@@ -273,7 +273,7 @@ class Area {
273
  if ( $this->is_admin_page( 'logs' ) ) {
274
  \wp_enqueue_style(
275
  'wp-mail-smtp-admin-logs',
276
- apply_filters( 'wp_mail_smtp_admin_enqueue_assets_logs_css', \wp_mail_smtp()->assets_url . '/css/smtp-logs.min.css' ),
277
  array( 'wp-mail-smtp-admin' ),
278
  WPMS_PLUGIN_VER
279
  );
@@ -538,10 +538,12 @@ class Area {
538
 
539
  if ( empty( $this->pages ) ) {
540
  $this->pages = array(
541
- 'settings' => new Pages\Settings(),
542
- 'test' => new Pages\Test(),
543
- 'misc' => new Pages\Misc(),
544
- 'auth' => new Pages\Auth(),
 
 
545
  );
546
  }
547
 
@@ -616,6 +618,26 @@ class Area {
616
  return is_admin() && $pages_equal;
617
  }
618
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
619
  /**
620
  * All possible plugin forms manipulation will be done here.
621
  *
@@ -670,7 +692,7 @@ class Area {
670
  wp_send_json_error( $data );
671
  }
672
 
673
- $task = sanitize_key( $_POST['task'] );
674
 
675
  switch ( $task ) {
676
  case 'pro_banner_dismiss':
@@ -686,6 +708,17 @@ class Area {
686
  Pages\About::ajax_plugin_activate();
687
  break;
688
 
 
 
 
 
 
 
 
 
 
 
 
689
  default:
690
  // Allow custom tasks data processing being added here.
691
  $data = apply_filters( 'wp_mail_smtp_admin_process_ajax_' . $task . '_data', $data );
154
  public function display_setup_notice() {
155
 
156
  // Bail if we're not on a plugin page.
157
+ if ( ! $this->is_admin_page( 'general' ) ) {
158
  return;
159
  }
160
 
179
  'strong' => array(),
180
  )
181
  ),
182
+ wp_mail_smtp()->get_admin()->get_admin_page_url( self::SLUG . '#wp-mail-smtp-setting-row-mailer' )
183
  ),
184
  WP::ADMIN_NOTICE_INFO
185
  );
233
  * Enqueue admin area scripts and styles.
234
  *
235
  * @since 1.0.0
236
+ * @since 1.5.0 Added new assets for new pages.
237
  *
238
  * @param string $hook
239
  */
273
  if ( $this->is_admin_page( 'logs' ) ) {
274
  \wp_enqueue_style(
275
  'wp-mail-smtp-admin-logs',
276
+ apply_filters( 'wp_mail_smtp_admin_enqueue_assets_logs_css', '' ),
277
  array( 'wp-mail-smtp-admin' ),
278
  WPMS_PLUGIN_VER
279
  );
538
 
539
  if ( empty( $this->pages ) ) {
540
  $this->pages = array(
541
+ 'settings' => new Pages\SettingsTab(),
542
+ 'test' => new Pages\TestTab(),
543
+ 'logs' => new Pages\LogsTab(),
544
+ 'control' => new Pages\ControlTab(),
545
+ 'misc' => new Pages\MiscTab(),
546
+ 'auth' => new Pages\AuthTab(),
547
  );
548
  }
549
 
618
  return is_admin() && $pages_equal;
619
  }
620
 
621
+ /**
622
+ * Give ability to use either admin area option or a filter to hide error notices about failed email delivery.
623
+ * Filter has higher priority and overrides an option.
624
+ *
625
+ * @since 1.6.0
626
+ *
627
+ * @return bool
628
+ */
629
+ public function is_error_delivery_notice_enabled() {
630
+
631
+ $is_hard_enabled = (bool) apply_filters( 'wp_mail_smtp_admin_is_error_delivery_notice_enabled', true );
632
+
633
+ // If someone changed the value to false using a filter - disable completely.
634
+ if ( ! $is_hard_enabled ) {
635
+ return false;
636
+ }
637
+
638
+ return ! (bool) Options::init()->get( 'general', 'email_delivery_errors_hidden' );
639
+ }
640
+
641
  /**
642
  * All possible plugin forms manipulation will be done here.
643
  *
692
  wp_send_json_error( $data );
693
  }
694
 
695
+ $task = sanitize_key( $_POST['task'] ); // phpcs:ignore
696
 
697
  switch ( $task ) {
698
  case 'pro_banner_dismiss':
708
  Pages\About::ajax_plugin_activate();
709
  break;
710
 
711
+ case 'notice_dismiss':
712
+ $notice = sanitize_key( $_POST['notice'] ); // phpcs:ignore
713
+ $mailer = sanitize_key( $_POST['mailer'] ); // phpcs:ignore
714
+ if ( empty( $notice ) || empty( $mailer ) ) {
715
+ break;
716
+ }
717
+
718
+ update_user_meta( get_current_user_id(), "wp_mail_smtp_notice_{$notice}_for_{$mailer}_dismissed", true );
719
+ $data['message'] = esc_html__( 'Educational notice for this mailer was successfully dismissed.', 'wp-mail-smtp' );
720
+ break;
721
+
722
  default:
723
  // Allow custom tasks data processing being added here.
724
  $data = apply_filters( 'wp_mail_smtp_admin_process_ajax_' . $task . '_data', $data );
src/Admin/Pages/About.php CHANGED
@@ -181,7 +181,7 @@ class About extends PageAbstract {
181
  printf(
182
  wp_kses(
183
  /* translators: %1$s - WPBeginner URL, %2$s - OptinMonster URL, %3$s - MonsterInsights URL. */
184
- __( 'WP Mail SMTP is brought to you by the same team that\'s behind the most user friendly WordPress forms, <a href="%1$s" target="_blank" rel="noopener noreferrer">WPForms</a>, the largest WordPress resource site, <a href="%1$s" target="_blank" rel="noopener noreferrer">WPBeginner</a>, the most popular lead-generation software, <a href="%2$s" target="_blank" rel="noopener noreferrer">OptinMonster</a>, and the best WordPress analytics plugin, <a href="%3$s" target="_blank" rel="noopener noreferrer">MonsterInsights</a>.', 'wp-mail-smtp' ),
185
  array(
186
  'a' => array(
187
  'href' => array(),
181
  printf(
182
  wp_kses(
183
  /* translators: %1$s - WPBeginner URL, %2$s - OptinMonster URL, %3$s - MonsterInsights URL. */
184
+ __( 'WP Mail SMTP is brought to you by the same team that\'s behind the most user friendly WordPress forms, <a href="%1$s" target="_blank" rel="noopener noreferrer">WPForms</a>, the largest WordPress resource site, <a href="%2$s" target="_blank" rel="noopener noreferrer">WPBeginner</a>, the most popular lead-generation software, <a href="%3$s" target="_blank" rel="noopener noreferrer">OptinMonster</a>, and the best WordPress analytics plugin, <a href="%4$s" target="_blank" rel="noopener noreferrer">MonsterInsights</a>.', 'wp-mail-smtp' ),
185
  array(
186
  'a' => array(
187
  'href' => array(),
src/Admin/Pages/{Auth.php → AuthTab.php} RENAMED
@@ -6,11 +6,11 @@ use WPMailSMTP\Options;
6
  use WPMailSMTP\Providers\AuthAbstract;
7
 
8
  /**
9
- * Class Auth.
10
  *
11
  * @since 1.0.0
12
  */
13
- class Auth {
14
 
15
  /**
16
  * @var string Slug of a tab.
6
  use WPMailSMTP\Providers\AuthAbstract;
7
 
8
  /**
9
+ * Class AuthTab.
10
  *
11
  * @since 1.0.0
12
  */
13
+ class AuthTab {
14
 
15
  /**
16
  * @var string Slug of a tab.
src/Admin/Pages/ControlTab.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPMailSMTP\Admin\Pages;
4
+
5
+ use WPMailSMTP\Admin\PageAbstract;
6
+
7
+ /**
8
+ * Class ControlTab is a placeholder for Pro Email Control tab settings.
9
+ * Displays an upsell.
10
+ *
11
+ * @since 1.6.0
12
+ */
13
+ class ControlTab extends PageAbstract {
14
+
15
+ /**
16
+ * @since 1.6.0
17
+ *
18
+ * @var string Slug of a tab.
19
+ */
20
+ protected $slug = 'control';
21
+
22
+ /**
23
+ * @inheritdoc
24
+ */
25
+ public function get_label() {
26
+
27
+ return esc_html__( 'Email Controls', 'wp-mail-smtp' );
28
+ }
29
+
30
+ /**
31
+ * @inheritdoc
32
+ */
33
+ public function get_title() {
34
+
35
+ return $this->get_label();
36
+ }
37
+
38
+ /**
39
+ * @inheritdoc
40
+ */
41
+ public function display() {
42
+
43
+ $features = array(
44
+ array(
45
+ 'image' => 'comments.png',
46
+ 'title' => esc_html__( 'Comment Notifications', 'wp-mail-smtp' ),
47
+ 'desc' => esc_html__( 'Manage emails sent when comments are published or awaiting moderation.', 'wp-mail-smtp' ),
48
+ ),
49
+ array(
50
+ 'image' => 'admin.png',
51
+ 'title' => esc_html__( 'Site Admin Email Change Notifications', 'wp-mail-smtp' ),
52
+ 'desc' => esc_html__( 'Manage emails sent when site admin\'s account has been changed.', 'wp-mail-smtp' ),
53
+ ),
54
+ array(
55
+ 'image' => 'users.png',
56
+ 'title' => esc_html__( 'User Change Notifications', 'wp-mail-smtp' ),
57
+ 'desc' => esc_html__( 'Limit emails triggered by password changed/reset, email changed, and more.', 'wp-mail-smtp' ),
58
+ ),
59
+ array(
60
+ 'image' => 'personal.png',
61
+ 'title' => esc_html__( 'Personal Data Requests Notifications', 'wp-mail-smtp' ),
62
+ 'desc' => esc_html__( 'Control emails for data requests and data removal actions.', 'wp-mail-smtp' ),
63
+ ),
64
+ array(
65
+ 'image' => 'update.png',
66
+ 'title' => esc_html__( 'Automatic Update Notifications', 'wp-mail-smtp' ),
67
+ 'desc' => esc_html__( 'Manage emails sent by the core automatic update process.', 'wp-mail-smtp' ),
68
+ ),
69
+ array(
70
+ 'image' => 'user_new.png',
71
+ 'title' => esc_html__( 'New User Notifications', 'wp-mail-smtp' ),
72
+ 'desc' => esc_html__( 'Toggle emails sent to both user and site administrator about new user accounts.', 'wp-mail-smtp' ),
73
+ ),
74
+
75
+ )
76
+ ?>
77
+
78
+ <div class="wp-mail-smtp-page-upsell">
79
+ <h2><?php esc_html_e( 'Unlock Email Controls', 'wp-mail-smtp' ); ?></h2>
80
+
81
+ <h3>
82
+ <?php esc_html_e( 'Email Controls allows you to granularly manage emails sent by WordPress.
', 'wp-mail-smtp' ); ?>
83
+ </h3>
84
+
85
+ <div class="wp-mail-smtp-page-upsell-content">
86
+
87
+ <div class="wp-mail-smtp-page-upsell-features">
88
+ <?php foreach ( $features as $feature ) : ?>
89
+ <div class="wp-mail-smtp-page-upsell-feature">
90
+ <div class="wp-mail-smtp-page-upsell-feature-image">
91
+ <img src="<?php echo esc_url( wp_mail_smtp()->assets_url . '/images/control/' . $feature['image'] ); ?>" alt="">
92
+ </div>
93
+ <div class="wp-mail-smtp-page-upsell-feature-content">
94
+ <h4><?php echo esc_html( $feature['title'] ); ?></h4>
95
+ <p><?php echo esc_html( $feature['desc'] ); ?></p>
96
+ </div>
97
+ </div>
98
+ <?php endforeach; ?>
99
+ </div>
100
+
101
+ </div>
102
+
103
+ <div class="wp-mail-smtp-page-upsell-button">
104
+ <a href="https://wpmailsmtp.com/lite-upgrade/?discount=LITEUPGRADE&amp;utm_source=WordPress&amp;utm_medium=logs&amp;utm_campaign=liteplugin"
105
+ class="wp-mail-smtp-btn wp-mail-smtp-btn-lg wp-mail-smtp-btn-orange" target="_blank" rel="noopener noreferrer">
106
+ <?php esc_html_e( 'Upgrade to WP Mail SMTP Pro', 'wp-mail-smtp' ); ?>
107
+ </a>
108
+ </div>
109
+
110
+ </div>
111
+
112
+ <?php
113
+ }
114
+
115
+ /**
116
+ * Not used as we display an upsell.
117
+ *
118
+ * @since 1.6.0
119
+ *
120
+ * @param array $data
121
+ */
122
+ public function process_post( $data ) {
123
+ }
124
+ }
src/Admin/Pages/Logs.php CHANGED
@@ -59,45 +59,23 @@ class Logs extends PageAbstract {
59
  </h1>
60
  </div>
61
 
62
- <div class="wp-mail-smtp-page wp-mail-smtp-page-<?php echo esc_attr( $this->slug ); ?>">
 
63
 
64
- <h1 class="screen-reader-text">
65
- <?php echo esc_html( $this->get_label() track of every email sent from your WordPress site with email logging.
', 'wp-mail-smtp' ); ?>
66
- </h1>
 
 
 
 
 
 
67
 
68
- <div class="wp-mail-smtp-logs-upsell">
69
- <div class="wp-mail-smtp-logs-upsell-content">
70
- <h2>
71
- <?php esc_html_e( 'View and Manage All Sent Emails inside WordPress', 'wp-mail-smtp' ); ?>
72
- </h2>
73
-
74
- <p>
75
- <strong><?php esc_html_e( 'Sent emails are not stored in WP Mail SMTP Lite.', 'wp-mail-smtp' ); ?></strong><br>
76
- <?php esc_html_e( 'Once you upgrade to WP Mail SMTP Pro, all future sent emails will be stored in your WordPress database and displayed on this Logs screen.', 'wp-mail-smtp' ); ?>
77
- </p>
78
-
79
- <div class="wp-mail-smtp-clear">
80
- <ul class="left">
81
- <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'View Sent Emails in Dashboard', 'wp-mail-smtp' ); ?></li>
82
- <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'View Emails Sent Status', 'wp-mail-smtp' ); ?></li>
83
- </ul>
84
- <ul class="right">
85
- <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Filter All Emails', 'wp-mail-smtp' ); ?></li>
86
- <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Search for Specific Emails', 'wp-mail-smtp' ); ?></li>
87
- </ul>
88
- <div class="clear"></div>
89
- </div>
90
- </div>
91
-
92
- <div class="wp-mail-smtp-logs-upsell-button">
93
- <a href="https://wpmailsmtp.com/lite-upgrade/?discount=LITEUPGRADE&amp;utm_source=WordPress&amp;utm_medium=logs&amp;utm_campaign=liteplugin" class="wp-mail-smtp-btn wp-mail-smtp-btn-lg wp-mail-smtp-btn-orange wp-mail-smtp-upgrade-modal" target="_blank" rel="noopener noreferrer">
94
- <?php esc_html_e( 'Upgrade to WP Mail SMTP Pro Now', 'wp-mail-smtp' ); ?>
95
- </a>
96
- <br>
97
- <p style="margin: 10px 0 0;font-style:italic;font-size: 13px;">
98
- <?php esc_html_e( 'and start logging all emails!', 'wp-mail-smtp' ); ?>
99
- </p>
100
- </div>
101
  </div>
102
 
103
  </div>
59
  </h1>
60
  </div>
61
 
62
+ <div class="wp-mail-smtp-page-upsell">
63
+ <h2><?php esc_html_e( 'Unlock Email Logging', 'wp-mail-smtp' ); ?></h2>
64
 
65
+ <h3>
66
+ <?php esc_html_e( 'Keep track of every email sent from your WordPress site with email logging.
', 'wp-mail-smtp' ); ?><br>
67
+ <?php esc_html_e( 'Troubleshoot sending issues, recover lost emails, and more!', 'wp-mail-smtp' ); ?>
68
+ </h3>
69
+
70
+ <div class="wp-mail-smtp-page-upsell-images">
71
+ <img src="<?php echo esc_url( wp_mail_smtp()->assets_url . '/images/logs/archive.png' ); ?>" alt="<?php esc_attr_e( 'Logs Archive Page Screenshot', 'wp-mail-smtp' ); ?>">
72
+ <img src="<?php echo esc_url( wp_mail_smtp()->assets_url . '/images/logs/single.png' ); ?>" alt="<?php esc_attr_e( 'Logs Single Page Screenshot', 'wp-mail-smtp' ); ?>">
73
+ </div>
74
 
75
+ <div class="wp-mail-smtp-page-upsell-button">
76
+ <a href="https://wpmailsmtp.com/lite-upgrade/?discount=LITEUPGRADE&amp;utm_source=WordPress&amp;utm_medium=logs&amp;utm_campaign=liteplugin" class="wp-mail-smtp-btn wp-mail-smtp-btn-lg wp-mail-smtp-btn-orange wp-mail-smtp-upgrade-modal" target="_blank" rel="noopener noreferrer">
77
+ <?php esc_html_e( 'Upgrade to WP Mail SMTP Pro', 'wp-mail-smtp' ); ?>
78
+ </a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  </div>
80
 
81
  </div>
src/Admin/Pages/LogsTab.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPMailSMTP\Admin\Pages;
4
+
5
+ use WPMailSMTP\Admin\Area;
6
+ use WPMailSMTP\Admin\PageAbstract;
7
+
8
+ /**
9
+ * Class LogsTab is a placeholder for Lite users and redirects them to Email Log page.
10
+ *
11
+ * @since 1.6.0
12
+ */
13
+ class LogsTab extends PageAbstract {
14
+
15
+ /**
16
+ * Part of the slug of a tab.
17
+ *
18
+ * @since 1.6.0
19
+ *
20
+ * @var string
21
+ */
22
+ protected $slug = 'logs';
23
+
24
+ /**
25
+ * @inheritdoc
26
+ *
27
+ * @since 1.6.0
28
+ */
29
+ public function get_label() {
30
+
31
+ return esc_html__( 'Email Log', 'wp-mail-smtp' );
32
+ }
33
+
34
+ /**
35
+ * @inheritdoc
36
+ *
37
+ * @since 1.6.0
38
+ */
39
+ public function get_title() {
40
+
41
+ return $this->get_label();
42
+ }
43
+
44
+ /**
45
+ * Custom URL for this tab, redirects to Email Log page.
46
+ *
47
+ * @since 1.6.0
48
+ *
49
+ * @return string
50
+ */
51
+ public function get_link() {
52
+
53
+ return wp_mail_smtp()->get_admin()->get_admin_page_url( Area::SLUG . '-' . $this->slug );
54
+ }
55
+
56
+ /**
57
+ * Not used as we are simply redirecting users.
58
+ *
59
+ * @since 1.6.0
60
+ */
61
+ public function display() {
62
+ }
63
+
64
+ /**
65
+ * Not used as we are simply redirecting users.
66
+ *
67
+ * @since 1.6.0
68
+ *
69
+ * @param array $data
70
+ */
71
+ public function process_post( $data ) {
72
+ }
73
+ }
src/Admin/Pages/{Misc.php → MiscTab.php} RENAMED
@@ -7,11 +7,11 @@ use WPMailSMTP\Options;
7
  use WPMailSMTP\WP;
8
 
9
  /**
10
- * Class Misc is part of Area, displays different plugin-related settings of the plugin (not related to emails).
11
  *
12
  * @since 1.0.0
13
  */
14
- class Misc extends PageAbstract {
15
  /**
16
  * @var string Slug of a tab.
17
  */
@@ -45,7 +45,7 @@ class Misc extends PageAbstract {
45
  <!-- Section Title -->
46
  <div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading no-desc" id="wp-mail-smtp-setting-row-email-heading">
47
  <div class="wp-mail-smtp-setting-field">
48
- <h2><?php esc_html_e( 'General', 'wp-mail-smtp' ); ?></h2>
49
  </div>
50
  </div>
51
 
@@ -101,6 +101,54 @@ class Misc extends PageAbstract {
101
  </div>
102
  </div>
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  <!-- Uninstall -->
105
  <div id="wp-mail-smtp-setting-row-uninstall" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
106
  <div class="wp-mail-smtp-setting-label">
7
  use WPMailSMTP\WP;
8
 
9
  /**
10
+ * Class MiscTab is part of Area, displays different plugin-related settings of the plugin (not related to emails).
11
  *
12
  * @since 1.0.0
13
  */
14
+ class MiscTab extends PageAbstract {
15
  /**
16
  * @var string Slug of a tab.
17
  */
45
  <!-- Section Title -->
46
  <div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading no-desc" id="wp-mail-smtp-setting-row-email-heading">
47
  <div class="wp-mail-smtp-setting-field">
48
+ <h2><?php echo $this->get_title(); ?></h2>
49
  </div>
50
  </div>
51
 
101
  </div>
102
  </div>
103
 
104
+ <!-- Hide Email Delivery Errors -->
105
+ <div id="wp-mail-smtp-setting-row-email_delivery_errors_hidden"
106
+ class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
107
+ <div class="wp-mail-smtp-setting-label">
108
+ <label for="wp-mail-smtp-setting-email_delivery_errors_hidden">
109
+ <?php esc_html_e( 'Hide Email Delivery Errors', 'wp-mail-smtp' ); ?>
110
+ </label>
111
+ </div>
112
+ <div class="wp-mail-smtp-setting-field">
113
+ <?php
114
+ $is_hard_disabled = has_filter( 'wp_mail_smtp_admin_is_error_delivery_notice_enabled' ) && ! wp_mail_smtp()->get_admin()->is_error_delivery_notice_enabled();
115
+ ?>
116
+ <?php if ( $is_hard_disabled ) : ?>
117
+ <input type="checkbox" disabled checked id="wp-mail-smtp-setting-email_delivery_errors_hidden">
118
+ <?php else : ?>
119
+ <input name="wp-mail-smtp[general][email_delivery_errors_hidden]" type="checkbox" value="true"
120
+ <?php checked( true, $options->get( 'general', 'email_delivery_errors_hidden' ) ); ?>
121
+ id="wp-mail-smtp-setting-email_delivery_errors_hidden">
122
+ <?php endif; ?>
123
+
124
+ <label for="wp-mail-smtp-setting-email_delivery_errors_hidden">
125
+ <?php esc_html_e( 'Check this if you would like to hide warnings alerting of email delivery errors.', 'wp-mail-smtp' ); ?>
126
+ </label>
127
+
128
+ <?php if ( $is_hard_disabled ) : ?>
129
+ <p class="desc">
130
+ <?php
131
+ printf( /* translators: %s - filter that was used to disabled. */
132
+ esc_html__( 'Email Delivery Errors were disabled using a %s filter.', 'wp-mail-smtp' ),
133
+ '<code>wp_mail_smtp_admin_is_error_delivery_notice_enabled</code>'
134
+ );
135
+ ?>
136
+ </p>
137
+ <?php else : ?>
138
+ <p class="desc">
139
+ <?php
140
+ echo wp_kses(
141
+ __( '<strong>This is not recommended</strong> and should only be done for staging or development sites.', 'wp-mail-smtp' ),
142
+ array(
143
+ 'strong' => true,
144
+ )
145
+ );
146
+ ?>
147
+ </p>
148
+ <?php endif; ?>
149
+ </div>
150
+ </div>
151
+
152
  <!-- Uninstall -->
153
  <div id="wp-mail-smtp-setting-row-uninstall" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-checkbox wp-mail-smtp-clear">
154
  <div class="wp-mail-smtp-setting-label">
src/Admin/Pages/{Settings.php → SettingsTab.php} RENAMED
@@ -8,11 +8,11 @@ use WPMailSMTP\Options;
8
  use WPMailSMTP\WP;
9
 
10
  /**
11
- * Class Settings is part of Area, displays general settings of the plugin.
12
  *
13
  * @since 1.0.0
14
  */
15
- class Settings extends PageAbstract {
16
 
17
  /**
18
  * Settings constructor.
@@ -206,7 +206,8 @@ class Settings extends PageAbstract {
206
  <?php foreach ( wp_mail_smtp()->get_providers()->get_options_all() as $provider ) : ?>
207
 
208
  <div class="wp-mail-smtp-mailer wp-mail-smtp-mailer-<?php echo esc_attr( $provider->get_slug() ); ?> <?php echo $mailer === $provider->get_slug() ? 'active' : ''; ?>">
209
- <div class="wp-mail-smtp-mailer-image">
 
210
  <img src="<?php echo esc_url( $provider->get_logo_url() ); ?>"
211
  alt="<?php echo esc_attr( $provider->get_title() ); ?>">
212
  </div>
@@ -236,11 +237,29 @@ class Settings extends PageAbstract {
236
 
237
  <div class="wp-mail-smtp-mailer-option wp-mail-smtp-mailer-option-<?php echo esc_attr( $provider->get_slug() ); ?> <?php echo $mailer === $provider->get_slug() ? 'active' : 'hidden'; ?>">
238
 
239
- <!-- Mailer Option Title -->
240
  <?php $provider_desc = $provider->get_description(); ?>
241
  <div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading <?php echo empty( $provider_desc ) ? 'no-desc' : ''; ?>" id="wp-mail-smtp-setting-row-email-heading">
242
  <div class="wp-mail-smtp-setting-field">
243
  <h2><?php echo $provider->get_title(); ?></h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  <?php if ( ! empty( $provider_desc ) ) : ?>
245
  <p class="desc"><?php echo $provider_desc; ?></p>
246
  <?php endif; ?>
8
  use WPMailSMTP\WP;
9
 
10
  /**
11
+ * Class SettingsTab is part of Area, displays general settings of the plugin.
12
  *
13
  * @since 1.0.0
14
  */
15
+ class SettingsTab extends PageAbstract {
16
 
17
  /**
18
  * Settings constructor.
206
  <?php foreach ( wp_mail_smtp()->get_providers()->get_options_all() as $provider ) : ?>
207
 
208
  <div class="wp-mail-smtp-mailer wp-mail-smtp-mailer-<?php echo esc_attr( $provider->get_slug() ); ?> <?php echo $mailer === $provider->get_slug() ? 'active' : ''; ?>">
209
+
210
+ <div class="wp-mail-smtp-mailer-image <?php echo $provider->is_recommended() ? 'is-recommended' : ''; ?>">
211
  <img src="<?php echo esc_url( $provider->get_logo_url() ); ?>"
212
  alt="<?php echo esc_attr( $provider->get_title() ); ?>">
213
  </div>
237
 
238
  <div class="wp-mail-smtp-mailer-option wp-mail-smtp-mailer-option-<?php echo esc_attr( $provider->get_slug() ); ?> <?php echo $mailer === $provider->get_slug() ? 'active' : 'hidden'; ?>">
239
 
240
+ <!-- Mailer Title/Notice/Description -->
241
  <?php $provider_desc = $provider->get_description(); ?>
242
  <div class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-content wp-mail-smtp-clear section-heading <?php echo empty( $provider_desc ) ? 'no-desc' : ''; ?>" id="wp-mail-smtp-setting-row-email-heading">
243
  <div class="wp-mail-smtp-setting-field">
244
  <h2><?php echo $provider->get_title(); ?></h2>
245
+
246
+ <?php
247
+ $provider_edu_notice = $provider->get_notice( 'educational' );
248
+ $is_dismissed = (bool) get_user_meta( get_current_user_id(), "wp_mail_smtp_notice_educational_for_{$provider->get_slug()}_dismissed", true );
249
+ if ( ! empty( $provider_edu_notice ) && ! $is_dismissed ) :
250
+ ?>
251
+ <p class="inline-notice inline-edu-notice"
252
+ data-notice="educational"
253
+ data-mailer="<?php echo esc_attr( $provider->get_slug() ); ?>">
254
+ <a href="#" title="<?php esc_attr_e( 'Dismiss this notice', 'wp-mail-smtp' ); ?>"
255
+ class="wp-mail-smtp-mailer-notice-dismiss js-wp-mail-smtp-mailer-notice-dismiss">
256
+ <span class="dashicons dashicons-dismiss"></span>
257
+ </a>
258
+
259
+ <?php echo $provider_edu_notice; ?>
260
+ </p>
261
+ <?php endif; ?>
262
+
263
  <?php if ( ! empty( $provider_desc ) ) : ?>
264
  <p class="desc"><?php echo $provider_desc; ?></p>
265
  <?php endif; ?>
src/Admin/Pages/{Test.php → TestTab.php} RENAMED
@@ -10,11 +10,11 @@ use WPMailSMTP\WP;
10
  use WPMailSMTP\Admin\PageAbstract;
11
 
12
  /**
13
- * Class Test is part of Area, displays email testing page of the plugin.
14
  *
15
  * @since 1.0.0
16
  */
17
- class Test extends PageAbstract {
18
 
19
  /**
20
  * @var string Slug of a tab.
10
  use WPMailSMTP\Admin\PageAbstract;
11
 
12
  /**
13
+ * Class TestTab is part of Area, displays email testing page of the plugin.
14
  *
15
  * @since 1.0.0
16
  */
17
+ class TestTab extends PageAbstract {
18
 
19
  /**
20
  * @var string Slug of a tab.
src/Core.php CHANGED
@@ -211,6 +211,7 @@ class Core {
211
  * Whether the Pro part of the plugin is allowed to be loaded.
212
  *
213
  * @since 1.5.0
 
214
  *
215
  * @return bool
216
  */
@@ -226,7 +227,7 @@ class Core {
226
  $is_allowed = false;
227
  }
228
 
229
- return $is_allowed;
230
  }
231
 
232
  /**
@@ -404,6 +405,7 @@ class Core {
404
  * Display all debug mail-delivery related notices.
405
  *
406
  * @since 1.3.0
 
407
  */
408
  public static function display_general_notices() {
409
 
@@ -434,57 +436,56 @@ class Core {
434
  return;
435
  }
436
 
437
- $notice = Debug::get_last();
438
 
439
- if ( ! empty( $notice ) ) {
440
- ?>
441
 
442
- <div class="notice <?php echo esc_attr( WP::ADMIN_NOTICE_ERROR ); ?>">
443
- <p>
444
- <?php
445
- printf(
446
- wp_kses( /* translators: %s - plugin name and its version. */
447
- __( '<strong>EMAIL DELIVERY ERROR:</strong> the plugin %s logged this error during the last time it tried to send an email:', 'wp-mail-smtp' ),
448
- array(
449
- 'strong' => array(),
450
- )
451
- ),
452
- esc_html( 'WP Mail SMTP v' . WPMS_PLUGIN_VER )
453
- );
454
- ?>
455
- </p>
456
 
457
- <blockquote>
458
- <pre><?php echo $notice; ?></pre>
459
- </blockquote>
460
-
461
- <p>
462
- <?php
463
- if ( ! wp_mail_smtp()->get_admin()->is_admin_page() ) {
464
  printf(
465
- wp_kses( /* translators: %s - plugin admin page URL. */
466
- __( 'Please review your WP Mail SMTP settings in <a href="%s">plugin admin area</a>.' ) . ' ',
467
  array(
468
- 'a' => array(
469
- 'href' => array(),
470
- ),
471
  )
472
  ),
473
- esc_url( wp_mail_smtp()->get_admin()->get_admin_page_url() )
474
  );
475
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
 
477
- esc_html_e( 'Consider running an email test after fixing it.', 'wp-mail-smtp' );
478
- ?>
479
- </p>
480
- </div>
481
 
482
- <?php
483
- return;
484
  }
485
- ?>
486
-
487
- <?php
488
  }
489
 
490
  /**
211
  * Whether the Pro part of the plugin is allowed to be loaded.
212
  *
213
  * @since 1.5.0
214
+ * @since 1.6.0 Added a filter.
215
  *
216
  * @return bool
217
  */
227
  $is_allowed = false;
228
  }
229
 
230
+ return apply_filters( 'wp_mail_smtp_core_is_pro_allowed', $is_allowed );
231
  }
232
 
233
  /**
405
  * Display all debug mail-delivery related notices.
406
  *
407
  * @since 1.3.0
408
+ * @since 1.6.0 Added a filter that allows to hide debug errors.
409
  */
410
  public static function display_general_notices() {
411
 
436
  return;
437
  }
438
 
439
+ if ( wp_mail_smtp()->get_admin()->is_error_delivery_notice_enabled() ) {
440
 
441
+ $notice = Debug::get_last();
 
442
 
443
+ if ( ! empty( $notice ) ) {
444
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
445
 
446
+ <div class="notice <?php echo esc_attr( WP::ADMIN_NOTICE_ERROR ); ?>">
447
+ <p>
448
+ <?php
 
 
 
 
449
  printf(
450
+ wp_kses( /* translators: %s - plugin name and its version. */
451
+ __( '<strong>EMAIL DELIVERY ERROR:</strong> the plugin %s logged this error during the last time it tried to send an email:', 'wp-mail-smtp' ),
452
  array(
453
+ 'strong' => array(),
 
 
454
  )
455
  ),
456
+ esc_html( 'WP Mail SMTP v' . WPMS_PLUGIN_VER )
457
  );
458
+ ?>
459
+ </p>
460
+
461
+ <blockquote>
462
+ <pre><?php echo $notice; ?></pre>
463
+ </blockquote>
464
+
465
+ <p>
466
+ <?php
467
+ if ( ! wp_mail_smtp()->get_admin()->is_admin_page() ) {
468
+ printf(
469
+ wp_kses( /* translators: %s - plugin admin page URL. */
470
+ __( 'Please review your WP Mail SMTP settings in <a href="%s">plugin admin area</a>.' ) . ' ',
471
+ array(
472
+ 'a' => array(
473
+ 'href' => array(),
474
+ ),
475
+ )
476
+ ),
477
+ esc_url( wp_mail_smtp()->get_admin()->get_admin_page_url() )
478
+ );
479
+ }
480
 
481
+ esc_html_e( 'Consider running an email test after fixing it.', 'wp-mail-smtp' );
482
+ ?>
483
+ </p>
484
+ </div>
485
 
486
+ <?php
487
+ }
488
  }
 
 
 
489
  }
490
 
491
  /**
src/Debug.php CHANGED
@@ -26,15 +26,19 @@ class Debug {
26
  *
27
  * @since 1.2.0
28
  *
29
- * @param string $message
30
  */
31
  public static function set( $message ) {
32
 
33
- if ( ! is_string( $message ) ) {
34
- $message = \json_encode( $message );
35
  }
36
 
37
- $message = wp_strip_all_tags( $message, false );
 
 
 
 
38
 
39
  $all = self::get();
40
 
26
  *
27
  * @since 1.2.0
28
  *
29
+ * @param mixed $message
30
  */
31
  public static function set( $message ) {
32
 
33
+ if ( empty( $message ) ) {
34
+ return;
35
  }
36
 
37
+ if ( ! is_string( $message ) ) {
38
+ $message = wp_json_encode( $message );
39
+ } else {
40
+ $message = wp_strip_all_tags( $message, false );
41
+ }
42
 
43
  $all = self::get();
44
 
src/Geo.php CHANGED
@@ -46,6 +46,7 @@ class Geo {
46
  * We make a request to 3rd party services.
47
  *
48
  * @since 1.5.0
 
49
  *
50
  * @param string $ip
51
  *
@@ -58,6 +59,24 @@ class Geo {
58
  return array();
59
  }
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  $request = wp_remote_get( 'https://ipapi.co/' . $ip . '/json' );
62
 
63
  if ( ! is_wp_error( $request ) ) {
46
  * We make a request to 3rd party services.
47
  *
48
  * @since 1.5.0
49
+ * @since 1.6.0 Added new geo API endpoint, provided by WPForms.
50
  *
51
  * @param string $ip
52
  *
59
  return array();
60
  }
61
 
62
+ $request = wp_remote_get( 'https://geo.wpforms.com/v2/geolocate/json/' . $ip );
63
+
64
+ if ( ! is_wp_error( $request ) ) {
65
+ $request = json_decode( wp_remote_retrieve_body( $request ), true );
66
+ if ( ! empty( $request['latitude'] ) && ! empty( $request['longitude'] ) ) {
67
+ $data = array(
68
+ 'latitude' => sanitize_text_field( $request['latitude'] ),
69
+ 'longitude' => sanitize_text_field( $request['longitude'] ),
70
+ 'city' => sanitize_text_field( $request['city'] ),
71
+ 'region' => sanitize_text_field( $request['region_name'] ),
72
+ 'country' => sanitize_text_field( $request['country_code'] ),
73
+ 'postal' => sanitize_text_field( $request['zip_code'] ),
74
+ );
75
+
76
+ return $data;
77
+ }
78
+ }
79
+
80
  $request = wp_remote_get( 'https://ipapi.co/' . $ip . '/json' );
81
 
82
  if ( ! is_wp_error( $request ) ) {
src/Migration.php CHANGED
@@ -68,7 +68,7 @@ class Migration {
68
 
69
  Options::init()->set( $this->new_values, true );
70
 
71
- // Removing all options will be enabled some time in the future.
72
  // $this->clean_deprecated_data();
73
  }
74
 
68
 
69
  Options::init()->set( $this->new_values, true );
70
 
71
+ // Removing all old options will be enabled some time in the future.
72
  // $this->clean_deprecated_data();
73
  }
74
 
src/Options.php CHANGED
@@ -24,7 +24,7 @@ class Options {
24
  * @var array Map of all the default options of the plugin.
25
  */
26
  private static $map = array(
27
- 'mail' => array(
28
  'from_name',
29
  'from_email',
30
  'mailer',
@@ -32,7 +32,7 @@ class Options {
32
  'from_name_force',
33
  'from_email_force',
34
  ),
35
- 'smtp' => array(
36
  'host',
37
  'port',
38
  'encryption',
@@ -41,29 +41,32 @@ class Options {
41
  'user',
42
  'pass',
43
  ),
44
- 'gmail' => array(
45
  'client_id',
46
  'client_secret',
47
  ),
48
- 'outlook' => array(
49
  'client_id',
50
  'client_secret',
51
  ),
52
- 'amazonses' => array(
53
  'client_id',
54
  'client_secret',
55
  'region',
56
  'emails_pending',
57
  ),
58
- 'mailgun' => array(
59
  'api_key',
60
  'domain',
61
  'region',
62
  ),
63
- 'sendgrid' => array(
64
  'api_key',
65
  ),
66
- 'pepipost' => array(
 
 
 
67
  'host',
68
  'port',
69
  'encryption',
@@ -71,7 +74,7 @@ class Options {
71
  'user',
72
  'pass',
73
  ),
74
- 'license' => array(
75
  'key',
76
  ),
77
  );
@@ -335,6 +338,7 @@ class Options {
335
  * @since 1.0.0
336
  * @since 1.4.0 Added WPMS_MAILGUN_REGION.
337
  * @since 1.5.0 Added Outlook/AmazonSES, license key support.
 
338
  *
339
  * @param string $group
340
  * @param string $key
@@ -489,6 +493,16 @@ class Options {
489
 
490
  break;
491
 
 
 
 
 
 
 
 
 
 
 
492
  case 'license':
493
  switch ( $key ) {
494
  case 'key':
@@ -529,6 +543,7 @@ class Options {
529
  *
530
  * @since 1.0.0
531
  * @since 1.5.0 Added a filter, Outlook/AmazonSES, license key support.
 
532
  *
533
  * @param string $group
534
  * @param string $key
@@ -661,6 +676,15 @@ class Options {
661
 
662
  break;
663
 
 
 
 
 
 
 
 
 
 
664
  case 'license':
665
  switch ( $key ) {
666
  case 'key':
@@ -715,6 +739,7 @@ class Options {
715
  switch ( $option_name ) {
716
  case 'do_not_send':
717
  case 'am_notifications_hidden':
 
718
  case 'uninstall':
719
  $options[ $group ][ $option_name ] = (bool) $option_value;
720
  break;
@@ -757,7 +782,7 @@ class Options {
757
  $options[ $mailer ][ $option_name ] = $this->is_const_defined( $mailer, $option_name ) ? '' : trim( (string) $option_value );
758
  break;
759
 
760
- case 'api_key': // mailgun/sendgrid.
761
  case 'domain': // mailgun.
762
  case 'client_id': // gmail/outlook/amazonses.
763
  case 'client_secret': // gmail/outlook/amazonses.
24
  * @var array Map of all the default options of the plugin.
25
  */
26
  private static $map = array(
27
+ 'mail' => array(
28
  'from_name',
29
  'from_email',
30
  'mailer',
32
  'from_name_force',
33
  'from_email_force',
34
  ),
35
+ 'smtp' => array(
36
  'host',
37
  'port',
38
  'encryption',
41
  'user',
42
  'pass',
43
  ),
44
+ 'gmail' => array(
45
  'client_id',
46
  'client_secret',
47
  ),
48
+ 'outlook' => array(
49
  'client_id',
50
  'client_secret',
51
  ),
52
+ 'amazonses' => array(
53
  'client_id',
54
  'client_secret',
55
  'region',
56
  'emails_pending',
57
  ),
58
+ 'mailgun' => array(
59
  'api_key',
60
  'domain',
61
  'region',
62
  ),
63
+ 'sendgrid' => array(
64
  'api_key',
65
  ),
66
+ 'sendinblue' => array(
67
+ 'api_key',
68
+ ),
69
+ 'pepipost' => array(
70
  'host',
71
  'port',
72
  'encryption',
74
  'user',
75
  'pass',
76
  ),
77
+ 'license' => array(
78
  'key',
79
  ),
80
  );
338
  * @since 1.0.0
339
  * @since 1.4.0 Added WPMS_MAILGUN_REGION.
340
  * @since 1.5.0 Added Outlook/AmazonSES, license key support.
341
+ * @since 1.6.0 Added Sendinblue.
342
  *
343
  * @param string $group
344
  * @param string $key
493
 
494
  break;
495
 
496
+ case 'sendinblue':
497
+ switch ( $key ) {
498
+ case 'api_key':
499
+ /** @noinspection PhpUndefinedConstantInspection */
500
+ $return = $this->is_const_defined( $group, $key ) ? WPMS_SENDINBLUE_API_KEY : $value;
501
+ break;
502
+ }
503
+
504
+ break;
505
+
506
  case 'license':
507
  switch ( $key ) {
508
  case 'key':
543
  *
544
  * @since 1.0.0
545
  * @since 1.5.0 Added a filter, Outlook/AmazonSES, license key support.
546
+ * @since 1.6.0 Added Sendinblue.
547
  *
548
  * @param string $group
549
  * @param string $key
676
 
677
  break;
678
 
679
+ case 'sendinblue':
680
+ switch ( $key ) {
681
+ case 'api_key':
682
+ $return = defined( 'WPMS_SENDINBLUE_API_KEY' ) && WPMS_SENDINBLUE_API_KEY;
683
+ break;
684
+ }
685
+
686
+ break;
687
+
688
  case 'license':
689
  switch ( $key ) {
690
  case 'key':
739
  switch ( $option_name ) {
740
  case 'do_not_send':
741
  case 'am_notifications_hidden':
742
+ case 'email_delivery_errors_hidden':
743
  case 'uninstall':
744
  $options[ $group ][ $option_name ] = (bool) $option_value;
745
  break;
782
  $options[ $mailer ][ $option_name ] = $this->is_const_defined( $mailer, $option_name ) ? '' : trim( (string) $option_value );
783
  break;
784
 
785
+ case 'api_key': // mailgun/sendgrid/sendinblue.
786
  case 'domain': // mailgun.
787
  case 'client_id': // gmail/outlook/amazonses.
788
  case 'client_secret': // gmail/outlook/amazonses.
src/Providers/Gmail/Options.php CHANGED
@@ -31,9 +31,8 @@ class Options extends OptionsAbstract {
31
  'slug' => self::SLUG,
32
  'title' => esc_html__( 'Gmail', 'wp-mail-smtp' ),
33
  'description' => sprintf(
34
- wp_kses(
35
- /* translators: %1$s - opening link tag; %2$s - closing link tag. */
36
- __( 'Send emails using your Gmail or G Suite (formerly Google Apps) account, all while keeping your login credentials safe. Other Google SMTP methods require enabling less secure apps in your account and entering your password. However, this integration uses the Google API to improve email delivery issues while keeping your site secure.<br><br>Read our %1$sGmail documentation%2$s to learn how to configure Gmail or G Suite.', 'wp-mail-smtp' ),
37
  array(
38
  'br' => array(),
39
  'a' => array(
@@ -43,8 +42,10 @@ class Options extends OptionsAbstract {
43
  ),
44
  )
45
  ),
46
- '<a href="https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/" target="_blank" rel="noopener noreferrer">',
47
- '</a>'
 
 
48
  ),
49
  'php' => '5.5',
50
  )
@@ -92,7 +93,7 @@ class Options extends OptionsAbstract {
92
  />
93
  <?php $this->display_const_set_message( 'WPMS_GMAIL_CLIENT_SECRET' ); ?>
94
  <?php else : ?>
95
- <input type="text" spellcheck="false"
96
  name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][client_secret]"
97
  value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'client_secret' ) ); ?>"
98
  id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_secret"
@@ -187,7 +188,7 @@ class Options extends OptionsAbstract {
187
 
188
  <?php else : ?>
189
 
190
- <p class="inline-error">
191
  <?php esc_html_e( 'You need to save settings with Client ID and Client Secret before you can proceed.', 'wp-mail-smtp' ); ?>
192
  </p>
193
 
31
  'slug' => self::SLUG,
32
  'title' => esc_html__( 'Gmail', 'wp-mail-smtp' ),
33
  'description' => sprintf(
34
+ wp_kses( /* translators: %s - URL to our Gmail doc. */
35
+ __( 'Send emails using your Gmail or G Suite (formerly Google Apps) account, all while keeping your login credentials safe. Other Google SMTP methods require enabling less secure apps in your account and entering your password. However, this integration uses the Google API to improve email delivery issues while keeping your site secure.<br><br>Read our <a href="%s" target="_blank" rel="noopener noreferrer">Gmail documentation</a> to learn how to configure Gmail or G Suite.', 'wp-mail-smtp' ),
 
36
  array(
37
  'br' => array(),
38
  'a' => array(
42
  ),
43
  )
44
  ),
45
+ 'https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/'
46
+ ),
47
+ 'notices' => array(
48
+ 'educational' => esc_html__( 'The Gmail mailer works well for sites that send low numbers of emails. However, Gmail\'s API has rate limitations and a number of additional restrictions that can lead to challenges during setup. If you expect to send a high volume of emails, or if you find that your web host is not compatible with the Gmail API restrictions, then we recommend considering a different mailer option.', 'wp-mail-smtp' ),
49
  ),
50
  'php' => '5.5',
51
  )
93
  />
94
  <?php $this->display_const_set_message( 'WPMS_GMAIL_CLIENT_SECRET' ); ?>
95
  <?php else : ?>
96
+ <input type="password" spellcheck="false"
97
  name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][client_secret]"
98
  value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'client_secret' ) ); ?>"
99
  id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-client_secret"
188
 
189
  <?php else : ?>
190
 
191
+ <p class="inline-notice inline-error">
192
  <?php esc_html_e( 'You need to save settings with Client ID and Client Secret before you can proceed.', 'wp-mail-smtp' ); ?>
193
  </p>
194
 
src/Providers/Loader.php CHANGED
@@ -17,16 +17,18 @@ class Loader {
17
  * Key is the mailer option, value is the path to its classes.
18
  *
19
  * @since 1.0.0
 
20
  *
21
  * @var array
22
  */
23
  protected $providers = array(
24
- 'mail' => 'WPMailSMTP\Providers\Mail\\',
25
- 'gmail' => 'WPMailSMTP\Providers\Gmail\\',
26
- 'mailgun' => 'WPMailSMTP\Providers\Mailgun\\',
27
- 'sendgrid' => 'WPMailSMTP\Providers\Sendgrid\\',
28
- 'pepipost' => 'WPMailSMTP\Providers\Pepipost\\',
29
- 'smtp' => 'WPMailSMTP\Providers\SMTP\\',
 
30
  );
31
 
32
  /**
17
  * Key is the mailer option, value is the path to its classes.
18
  *
19
  * @since 1.0.0
20
+ * @since 1.6.0 Added Sendinblue.
21
  *
22
  * @var array
23
  */
24
  protected $providers = array(
25
+ 'mail' => 'WPMailSMTP\Providers\Mail\\',
26
+ 'sendinblue' => 'WPMailSMTP\Providers\Sendinblue\\',
27
+ 'mailgun' => 'WPMailSMTP\Providers\Mailgun\\',
28
+ 'sendgrid' => 'WPMailSMTP\Providers\Sendgrid\\',
29
+ 'gmail' => 'WPMailSMTP\Providers\Gmail\\',
30
+ 'smtp' => 'WPMailSMTP\Providers\SMTP\\',
31
+ 'pepipost' => 'WPMailSMTP\Providers\Pepipost\\',
32
  );
33
 
34
  /**
src/Providers/MailerAbstract.php CHANGED
@@ -145,33 +145,11 @@ abstract class MailerAbstract implements MailerInterface {
145
  }
146
 
147
  /**
148
- * @inheritdoc
149
- */
150
- public function set_subject( $subject ) {
151
-
152
- $this->set_body_param(
153
- array(
154
- 'subject' => $subject,
155
- )
156
- );
157
- }
158
-
159
- /**
160
- * Set the request params, that goes to the body of the HTTP request.
161
- *
162
- * @since 1.0.0
163
  *
164
- * @param array $param Key=>value of what should be sent to a 3rd party API.
165
  *
166
- * @internal param array $params
167
- */
168
- protected function set_body_param( $param ) {
169
-
170
- $this->body = Options::array_merge_recursive( $this->body, $param );
171
- }
172
-
173
- /**
174
- * @inheritdoc
175
  */
176
  public function set_headers( $headers ) {
177
 
@@ -188,7 +166,12 @@ abstract class MailerAbstract implements MailerInterface {
188
  }
189
 
190
  /**
191
- * @inheritdoc
 
 
 
 
 
192
  */
193
  public function set_header( $name, $value ) {
194
 
@@ -198,7 +181,41 @@ abstract class MailerAbstract implements MailerInterface {
198
  }
199
 
200
  /**
201
- * @inheritdoc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  */
203
  public function get_body() {
204
 
145
  }
146
 
147
  /**
148
+ * Set the email headers.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  *
150
+ * @since 1.0.0
151
  *
152
+ * @param array $headers List of key=>value pairs.
 
 
 
 
 
 
 
 
153
  */
154
  public function set_headers( $headers ) {
155
 
166
  }
167
 
168
  /**
169
+ * Set individual header key=>value pair for the email.
170
+ *
171
+ * @since 1.0.0
172
+ *
173
+ * @param string $name
174
+ * @param string $value
175
  */
176
  public function set_header( $name, $value ) {
177
 
181
  }
182
 
183
  /**
184
+ * Set email subject.
185
+ *
186
+ * @since 1.0.0
187
+ *
188
+ * @param string $subject
189
+ */
190
+ public function set_subject( $subject ) {
191
+
192
+ $this->set_body_param(
193
+ array(
194
+ 'subject' => $subject,
195
+ )
196
+ );
197
+ }
198
+
199
+ /**
200
+ * Set the request params, that goes to the body of the HTTP request.
201
+ *
202
+ * @since 1.0.0
203
+ *
204
+ * @param array $param Key=>value of what should be sent to a 3rd party API.
205
+ *
206
+ * @internal param array $params
207
+ */
208
+ protected function set_body_param( $param ) {
209
+
210
+ $this->body = Options::array_merge_recursive( $this->body, $param );
211
+ }
212
+
213
+ /**
214
+ * Get the email body.
215
+ *
216
+ * @since 1.0.0
217
+ *
218
+ * @return string|array
219
  */
220
  public function get_body() {
221
 
src/Providers/Mailgun/Options.php CHANGED
@@ -63,7 +63,7 @@ class Options extends OptionsAbstract {
63
  />
64
  <?php $this->display_const_set_message( 'WPMS_MAILGUN_API_KEY' ); ?>
65
  <?php else : ?>
66
- <input type="text" spellcheck="false"
67
  name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][api_key]"
68
  value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'api_key' ) ); ?>"
69
  id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
@@ -74,7 +74,7 @@ class Options extends OptionsAbstract {
74
  printf(
75
  /* translators: %s - API key link. */
76
  esc_html__( 'Follow this link to get an API Key from Mailgun: %s.', 'wp-mail-smtp' ),
77
- '<a href="https://app.mailgun.com/app/account/security" target="_blank" rel="noopener noreferrer">' .
78
  esc_html__( 'Get a Private API Key', 'wp-mail-smtp' ) .
79
  '</a>'
80
  );
63
  />
64
  <?php $this->display_const_set_message( 'WPMS_MAILGUN_API_KEY' ); ?>
65
  <?php else : ?>
66
+ <input type="password" spellcheck="false"
67
  name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][api_key]"
68
  value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'api_key' ) ); ?>"
69
  id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
74
  printf(
75
  /* translators: %s - API key link. */
76
  esc_html__( 'Follow this link to get an API Key from Mailgun: %s.', 'wp-mail-smtp' ),
77
+ '<a href="https://app.mailgun.com/app/account/security/api_keys" target="_blank" rel="noopener noreferrer">' .
78
  esc_html__( 'Get a Private API Key', 'wp-mail-smtp' ) .
79
  '</a>'
80
  );
src/Providers/OptionsAbstract.php CHANGED
@@ -27,6 +27,18 @@ abstract class OptionsAbstract implements OptionsInterface {
27
  * @var string
28
  */
29
  private $description = '';
 
 
 
 
 
 
 
 
 
 
 
 
30
  /**
31
  * @var string
32
  */
@@ -56,16 +68,39 @@ abstract class OptionsAbstract implements OptionsInterface {
56
  $this->title = sanitize_text_field( $params['title'] );
57
 
58
  if ( ! empty( $params['description'] ) ) {
59
- $this->description = wp_kses( $params['description'],
60
- array(
61
- 'br' => array(),
62
- 'a' => array(
63
- 'href' => array(),
64
- 'rel' => array(),
65
- 'target' => array(),
66
- ),
67
- )
68
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  }
70
 
71
  if ( ! empty( $params['php'] ) ) {
@@ -107,6 +142,22 @@ abstract class OptionsAbstract implements OptionsInterface {
107
  return apply_filters( 'wp_mail_smtp_providers_provider_get_description', $this->description, $this );
108
  }
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  /**
111
  * @inheritdoc
112
  */
@@ -305,6 +356,18 @@ abstract class OptionsAbstract implements OptionsInterface {
305
  <?php
306
  }
307
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  /**
309
  * Check whether we can use this provider based on the PHP version.
310
  * Valid for those, that use SDK.
@@ -337,7 +400,7 @@ abstract class OptionsAbstract implements OptionsInterface {
337
  );
338
  ?>
339
  <br>
340
- <?php esc_html_e( 'Meanwhile you can switch to the "Other SMTP" Mailer option.', 'wp-mail-smtp' ); ?>
341
  </blockquote>
342
 
343
  <?php
@@ -361,7 +424,7 @@ abstract class OptionsAbstract implements OptionsInterface {
361
  );
362
  ?>
363
  <br>
364
- <?php esc_html_e( 'Meanwhile you can switch to the "Other SMTP" Mailer option.', 'wp-mail-smtp' ); ?>
365
  </blockquote>
366
 
367
  <?php
27
  * @var string
28
  */
29
  private $description = '';
30
+ /**
31
+ * @since 1.6.0
32
+ *
33
+ * @var array
34
+ */
35
+ private $notices = array();
36
+ /**
37
+ * @since 1.6.0
38
+ *
39
+ * @var bool
40
+ */
41
+ private $recommended = false;
42
  /**
43
  * @var string
44
  */
68
  $this->title = sanitize_text_field( $params['title'] );
69
 
70
  if ( ! empty( $params['description'] ) ) {
71
+ $this->description = wp_kses_post( $params['description'] );
72
+ }
73
+
74
+ if ( ! empty( $params['notices'] ) ) {
75
+ foreach ( (array) $params['notices'] as $key => $notice ) {
76
+ $key = sanitize_key( $key );
77
+ if ( empty( $key ) ) {
78
+ continue;
79
+ }
80
+
81
+ $notice = wp_kses(
82
+ $notice,
83
+ array(
84
+ 'br' => true,
85
+ 'strong' => true,
86
+ 'em' => true,
87
+ 'a' => array(
88
+ 'href' => true,
89
+ 'rel' => true,
90
+ 'target' => true,
91
+ ),
92
+ )
93
+ );
94
+ if ( empty( $notice ) ) {
95
+ continue;
96
+ }
97
+
98
+ $this->notices[ $key ] = $notice;
99
+ }
100
+ }
101
+
102
+ if ( ! empty( $params['recommended'] ) ) {
103
+ $this->recommended = (bool) $params['recommended'];
104
  }
105
 
106
  if ( ! empty( $params['php'] ) ) {
142
  return apply_filters( 'wp_mail_smtp_providers_provider_get_description', $this->description, $this );
143
  }
144
 
145
+ /**
146
+ * Some mailers may display a notice above its options.
147
+ *
148
+ * @since 1.6.0
149
+ *
150
+ * @param string $type
151
+ *
152
+ * @return string
153
+ */
154
+ public function get_notice( $type ) {
155
+
156
+ $type = sanitize_key( $type );
157
+
158
+ return apply_filters( 'wp_mail_smtp_providers_provider_get_notice', isset( $this->notices[ $type ] ) ? $this->notices[ $type ] : '', $this );
159
+ }
160
+
161
  /**
162
  * @inheritdoc
163
  */
356
  <?php
357
  }
358
 
359
+ /**
360
+ * Whether this mailer is recommended or not.
361
+ *
362
+ * @since 1.6.0
363
+ *
364
+ * @return bool
365
+ */
366
+ public function is_recommended() {
367
+
368
+ return (bool) apply_filters( 'wp_mail_smtp_providers_provider_is_recommended', $this->recommended, $this );
369
+ }
370
+
371
  /**
372
  * Check whether we can use this provider based on the PHP version.
373
  * Valid for those, that use SDK.
400
  );
401
  ?>
402
  <br>
403
+ <?php esc_html_e( 'Meanwhile you can switch to some other mailers.', 'wp-mail-smtp' ); ?>
404
  </blockquote>
405
 
406
  <?php
424
  );
425
  ?>
426
  <br>
427
+ <?php esc_html_e( 'Meanwhile you can switch to some other mailers.', 'wp-mail-smtp' ); ?>
428
  </blockquote>
429
 
430
  <?php
src/Providers/Sendgrid/Mailer.php CHANGED
@@ -384,14 +384,9 @@ class Mailer extends MailerAbstract {
384
  */
385
  public function get_debug_info() {
386
 
387
- $mg_text = array();
388
 
389
- $options = new \WPMailSMTP\Options();
390
- $provider = $options->get_group( $this->mailer );
391
-
392
- $mg_text[] = '<strong>Api Key:</strong> ' . ( ! empty( $provider['api_key'] ) ? 'Yes' : 'No' );
393
-
394
- return implode( '<br>', $mg_text );
395
  }
396
 
397
  /**
384
  */
385
  public function get_debug_info() {
386
 
387
+ $sendgrid_text[] = '<strong>Api Key:</strong> ' . ( $this->is_mailer_complete() ? 'Yes' : 'No' );
388
 
389
+ return implode( '<br>', $sendgrid_text );
 
 
 
 
 
390
  }
391
 
392
  /**
src/Providers/Sendgrid/Options.php CHANGED
@@ -63,7 +63,7 @@ class Options extends OptionsAbstract {
63
  />
64
  <?php $this->display_const_set_message( 'WPMS_SENDGRID_API_KEY' ); ?>
65
  <?php else : ?>
66
- <input type="text" spellcheck="false"
67
  name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][api_key]"
68
  value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'api_key' ) ); ?>"
69
  id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
63
  />
64
  <?php $this->display_const_set_message( 'WPMS_SENDGRID_API_KEY' ); ?>
65
  <?php else : ?>
66
+ <input type="password" spellcheck="false"
67
  name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][api_key]"
68
  value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'api_key' ) ); ?>"
69
  id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
src/Providers/Sendinblue/Api.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPMailSMTP\Providers\Sendinblue;
4
+
5
+ /**
6
+ * Class Api is a wrapper for Sendinblue library with handy methods.
7
+ *
8
+ * @since 1.6.0
9
+ */
10
+ class Api {
11
+
12
+ /**
13
+ * Contains mailer options, constants + DB values.
14
+ *
15
+ * @since 1.6.0
16
+ *
17
+ * @var array
18
+ */
19
+ private $options;
20
+
21
+ /**
22
+ * API constructor that inits defaults and retrieves options.
23
+ *
24
+ * @since 1.6.0
25
+ */
26
+ public function __construct() {
27
+
28
+ $this->options = \WPMailSMTP\Options::init()->get_group( Options::SLUG );
29
+ }
30
+
31
+ /**
32
+ * Configure API key authorization: api-key.
33
+ *
34
+ * @since 1.6.0
35
+ *
36
+ * @return \SendinBlue\Client\Configuration
37
+ */
38
+ protected function get_api_config() {
39
+
40
+ return \SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey( 'api-key', isset( $this->options['api_key'] ) ? $this->options['api_key'] : '' );
41
+ }
42
+
43
+ /**
44
+ * Get the mailer client instance for Account API.
45
+ *
46
+ * @since 1.6.0
47
+ */
48
+ public function get_account_client() {
49
+
50
+ // Include the library.
51
+ require_once wp_mail_smtp()->plugin_path . '/vendor/autoload.php';
52
+
53
+ return new \SendinBlue\Client\Api\AccountApi( null, $this->get_api_config() );
54
+ }
55
+
56
+ /**
57
+ * Get the mailer client instance for Sender API.
58
+ *
59
+ * @since 1.6.0
60
+ */
61
+ public function get_sender_client() {
62
+
63
+ // Include the library.
64
+ require_once wp_mail_smtp()->plugin_path . '/vendor/autoload.php';
65
+
66
+ return new \SendinBlue\Client\Api\SendersApi( null, $this->get_api_config() );
67
+ }
68
+
69
+ /**
70
+ * Get the mailer client instance for SMTP API.
71
+ *
72
+ * @since 1.6.0
73
+ */
74
+ public function get_smtp_client() {
75
+
76
+ // Include the library.
77
+ require_once wp_mail_smtp()->plugin_path . '/vendor/autoload.php';
78
+
79
+ return new \SendinBlue\Client\Api\SMTPApi( null, $this->get_api_config() );
80
+ }
81
+
82
+ /**
83
+ * Whether the mailer is ready to be used in API calls.
84
+ *
85
+ * @since 1.6.0
86
+ *
87
+ * @return bool
88
+ */
89
+ public function is_ready() {
90
+
91
+ return ! empty( $this->options['api_key'] );
92
+ }
93
+ }
src/Providers/Sendinblue/Mailer.php ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPMailSMTP\Providers\Sendinblue;
4
+
5
+ use WPMailSMTP\Debug;
6
+ use WPMailSMTP\Providers\MailerAbstract;
7
+ use WPMailSMTP\WP;
8
+
9
+ /**
10
+ * Class Mailer.
11
+ *
12
+ * @since 1.6.0
13
+ */
14
+ class Mailer extends MailerAbstract {
15
+
16
+ /**
17
+ * Which response code from HTTP provider is considered to be successful?
18
+ *
19
+ * @since 1.6.0
20
+ *
21
+ * @var int
22
+ */
23
+ protected $email_sent_code = 201;
24
+
25
+ /**
26
+ * URL to make an API request to.
27
+ * Not actually used, because we use a lib to make requests.
28
+ *
29
+ * @since 1.6.0
30
+ *
31
+ * @var string
32
+ */
33
+ protected $url = 'https://api.sendinblue.com/v3';
34
+
35
+ /**
36
+ * The list of allowed attachment files extensions.
37
+ *
38
+ * @see https://developers.sendinblue.com/reference#sendTransacEmail_attachment__title
39
+ *
40
+ * @since 1.6.0
41
+ *
42
+ * @var array
43
+ */
44
+ // @formatter:off
45
+ protected $allowed_attach_ext = array( 'xlsx', 'xls', 'ods', 'docx', 'docm', 'doc', 'csv', 'pdf', 'txt', 'gif', 'jpg', 'jpeg', 'png', 'tif', 'tiff', 'rtf', 'bmp', 'cgm', 'css', 'shtml', 'html', 'htm', 'zip', 'xml', 'ppt', 'pptx', 'tar', 'ez', 'ics', 'mobi', 'msg', 'pub', 'eps', 'odt', 'mp3', 'm4a', 'm4v', 'wma', 'ogg', 'flac', 'wav', 'aif', 'aifc', 'aiff', 'mp4', 'mov', 'avi', 'mkv', 'mpeg', 'mpg', 'wmv' );
46
+ // @formatter:on
47
+
48
+ /**
49
+ * Mailer constructor.
50
+ *
51
+ * @since 1.6.0
52
+ *
53
+ * @param \WPMailSMTP\MailCatcher $phpmailer
54
+ */
55
+ public function __construct( $phpmailer ) {
56
+
57
+ parent::__construct( $phpmailer );
58
+
59
+ if ( ! $this->is_php_compatible() ) {
60
+ return;
61
+ }
62
+ }
63
+
64
+ /**
65
+ * @inheritDoc
66
+ *
67
+ * @since 1.6.0
68
+ */
69
+ public function set_header( $name, $value ) {
70
+
71
+ $name = sanitize_text_field( $name );
72
+
73
+ $this->body['headers'][ $name ] = WP::sanitize_value( $value );
74
+ }
75
+
76
+ /**
77
+ * Set the From information for an email.
78
+ *
79
+ * @since 1.6.0
80
+ *
81
+ * @param string $email
82
+ * @param string $name
83
+ */
84
+ public function set_from( $email, $name ) {
85
+
86
+ if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
87
+ return;
88
+ }
89
+
90
+ $this->body['sender'] = array(
91
+ 'email' => $email,
92
+ 'name' => ! empty( $name ) ? WP::sanitize_value( $name ) : '',
93
+ );
94
+ }
95
+
96
+ /**
97
+ * Set email recipients: to, cc, bcc.
98
+ *
99
+ * @since 1.6.0
100
+ *
101
+ * @param array $recipients
102
+ */
103
+ public function set_recipients( $recipients ) {
104
+
105
+ if ( empty( $recipients ) ) {
106
+ return;
107
+ }
108
+
109
+ // Allow for now only these recipient types.
110
+ $default = array( 'to', 'cc', 'bcc' );
111
+ $data = array();
112
+
113
+ foreach ( $recipients as $type => $emails ) {
114
+
115
+ if (
116
+ ! in_array( $type, $default, true ) ||
117
+ empty( $emails ) ||
118
+ ! is_array( $emails )
119
+ ) {
120
+ continue;
121
+ }
122
+
123
+ $data[ $type ] = array();
124
+
125
+ // Iterate over all emails for each type.
126
+ // There might be multiple cc/to/bcc emails.
127
+ foreach ( $emails as $email ) {
128
+ $holder = array();
129
+ $addr = isset( $email[0] ) ? $email[0] : false;
130
+ $name = isset( $email[1] ) ? $email[1] : false;
131
+
132
+ if ( ! filter_var( $addr, FILTER_VALIDATE_EMAIL ) ) {
133
+ continue;
134
+ }
135
+
136
+ $holder['email'] = $addr;
137
+ if ( ! empty( $name ) ) {
138
+ $holder['name'] = $name;
139
+ }
140
+
141
+ array_push( $data[ $type ], $holder );
142
+ }
143
+ }
144
+
145
+ foreach ( $data as $type => $type_recipients ) {
146
+ $this->body[ $type ] = $type_recipients;
147
+ }
148
+ }
149
+
150
+ /**
151
+ * @inheritDoc
152
+ *
153
+ * @since 1.6.0
154
+ */
155
+ public function set_subject( $subject ) {
156
+
157
+ $this->body['subject'] = $subject;
158
+ }
159
+
160
+ /**
161
+ * Set email content.
162
+ *
163
+ * @since 1.6.0
164
+ *
165
+ * @param string|array $content
166
+ */
167
+ public function set_content( $content ) {
168
+
169
+ if ( empty( $content ) ) {
170
+ return;
171
+ }
172
+
173
+ if ( is_array( $content ) ) {
174
+
175
+ if ( ! empty( $content['text'] ) ) {
176
+ $this->body['textContent'] = $content['text'];
177
+ }
178
+
179
+ if ( ! empty( $content['html'] ) ) {
180
+ $this->body['htmlContent'] = $content['html'];
181
+ }
182
+ } else {
183
+ if ( $this->phpmailer->ContentType === 'text/plain' ) {
184
+ $this->body['textContent'] = $content;
185
+ } else {
186
+ $this->body['htmlContent'] = $content;
187
+ }
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Doesn't support this.
193
+ *
194
+ * @since 1.6.0
195
+ *
196
+ * @param string $email
197
+ */
198
+ public function set_return_path( $email ) {
199
+
200
+ }
201
+
202
+ /**
203
+ * Set the Reply To headers if not set already.
204
+ *
205
+ * @since 1.6.0
206
+ *
207
+ * @param array $emails
208
+ */
209
+ public function set_reply_to( $emails ) {
210
+
211
+ if ( empty( $emails ) ) {
212
+ return;
213
+ }
214
+
215
+ $data = array();
216
+
217
+ foreach ( $emails as $user ) {
218
+ $holder = array();
219
+ $addr = isset( $user[0] ) ? $user[0] : false;
220
+ $name = isset( $user[1] ) ? $user[1] : false;
221
+
222
+ if ( ! filter_var( $addr, FILTER_VALIDATE_EMAIL ) ) {
223
+ continue;
224
+ }
225
+
226
+ $holder['email'] = $addr;
227
+ if ( ! empty( $name ) ) {
228
+ $holder['name'] = $name;
229
+ }
230
+
231
+ $data[] = $holder;
232
+ }
233
+
234
+ if ( ! empty( $data ) ) {
235
+ $this->body['replyTo'] = $data[0];
236
+ }
237
+ }
238
+
239
+ /**
240
+ * Set attachments for an email.
241
+ *
242
+ * @since 1.6.0
243
+ *
244
+ * @param array $attachments
245
+ */
246
+ public function set_attachments( $attachments ) {
247
+
248
+ if ( empty( $attachments ) ) {
249
+ return;
250
+ }
251
+
252
+ foreach ( $attachments as $attachment ) {
253
+ $file = false;
254
+
255
+ /*
256
+ * We are not using WP_Filesystem API as we can't reliably work with it.
257
+ * It is not always available, same as credentials for FTP.
258
+ */
259
+ try {
260
+ if ( is_file( $attachment[0] ) && is_readable( $attachment[0] ) ) {
261
+ $ext = pathinfo( $attachment[0], PATHINFO_EXTENSION );
262
+
263
+ if ( in_array( $ext, $this->allowed_attach_ext, true ) ) {
264
+ $file = file_get_contents( $attachment[0] ); // phpcs:ignore
265
+ }
266
+ }
267
+ }
268
+ catch ( \Exception $e ) {
269
+ $file = false;
270
+ }
271
+
272
+ if ( $file === false ) {
273
+ continue;
274
+ }
275
+
276
+ $this->body['attachment'][] = array(
277
+ 'name' => $attachment[2],
278
+ 'content' => base64_encode( $file ),
279
+ );
280
+ }
281
+ }
282
+
283
+ /**
284
+ * @inheritDoc
285
+ *
286
+ * @since 1.6.0
287
+ *
288
+ * @return \SendinBlue\Client\Model\SendSmtpEmail
289
+ */
290
+ public function get_body() {
291
+
292
+ return new \SendinBlue\Client\Model\SendSmtpEmail( $this->body );
293
+ }
294
+
295
+ /**
296
+ * Use a library to send emails.
297
+ *
298
+ * @since 1.6.0
299
+ */
300
+ public function send() {
301
+
302
+ try {
303
+ $api = new Api();
304
+
305
+ $response = $api->get_smtp_client()->sendTransacEmail( $this->get_body() );
306
+
307
+ $this->process_response( $response );
308
+ }
309
+ catch ( \SendinBlue\Client\ApiException $e ) {
310
+ $error = json_decode( $e->getResponseBody() );
311
+ if ( json_last_error() === JSON_ERROR_NONE ) {
312
+ Debug::set(
313
+ 'Mailer: Sendinblue' . "\r\n" .
314
+ '[' . sanitize_key( $error->code ) . ']: ' . esc_html( $error->message )
315
+ );
316
+ }
317
+ }
318
+ catch ( \Exception $e ) {
319
+ Debug::set(
320
+ 'Mailer: Sendinblue' . "\r\n" .
321
+ $e->getMessage()
322
+ );
323
+
324
+ return;
325
+ }
326
+ }
327
+
328
+ /**
329
+ * Save response from the API to use it later.
330
+ * All the actually response processing is done in send() method,
331
+ * because SendinBlue throws exception if any error occurs.
332
+ *
333
+ * @since 1.6.0
334
+ *
335
+ * @param \SendinBlue\Client\Model\CreateSmtpEmail $response
336
+ */
337
+ protected function process_response( $response ) {
338
+
339
+ $this->response = $response;
340
+ }
341
+
342
+ /**
343
+ * Check whether the email was sent.
344
+ *
345
+ * @since 1.6.0
346
+ *
347
+ * @return bool
348
+ */
349
+ public function is_email_sent() {
350
+
351
+ $is_sent = false;
352
+
353
+ if ( $this->response instanceof \SendinBlue\Client\Model\CreateSmtpEmail ) {
354
+ $is_sent = $this->response->valid();
355
+ }
356
+
357
+ // Clear debug messages if email is successfully sent.
358
+ if ( $is_sent ) {
359
+ Debug::clear();
360
+ }
361
+
362
+ return $is_sent;
363
+ }
364
+
365
+ /**
366
+ * @inheritdoc
367
+ *
368
+ * @since 1.6.0
369
+ */
370
+ public function get_debug_info() {
371
+
372
+ $mailjet_text[] = '<strong>API Key:</strong> ' . ( $this->is_mailer_complete() ? 'Yes' : 'No' );
373
+
374
+ return implode( '<br>', $mailjet_text );
375
+ }
376
+
377
+ /**
378
+ * @inheritdoc
379
+ *
380
+ * @since 1.6.0
381
+ */
382
+ public function is_mailer_complete() {
383
+
384
+ $options = $this->options->get_group( $this->mailer );
385
+
386
+ // API key is the only required option.
387
+ if ( ! empty( $options['api_key'] ) ) {
388
+ return true;
389
+ }
390
+
391
+ return false;
392
+ }
393
+ }
src/Providers/Sendinblue/Options.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WPMailSMTP\Providers\Sendinblue;
4
+
5
+ use WPMailSMTP\Providers\OptionsAbstract;
6
+ use WPMailSMTP\Options as PluginOptions;
7
+
8
+ /**
9
+ * Class Option.
10
+ *
11
+ * @since 1.6.0
12
+ */
13
+ class Options extends OptionsAbstract {
14
+
15
+ /**
16
+ * Mailer slug.
17
+ *
18
+ * @since 1.6.0
19
+ */
20
+ const SLUG = 'sendinblue';
21
+
22
+ /**
23
+ * Options constructor.
24
+ *
25
+ * @since 1.6.0
26
+ */
27
+ public function __construct() {
28
+
29
+ $description = sprintf(
30
+ wp_kses( /* translators: %1$s - URL to sendinblue.com site. */
31
+ __( '<strong><a href="%1$s" target="_blank" rel="noopener noreferrer">Sendinblue</a> is our recommended transactional email service.</strong> Founded in 2012, they serve 80,000+ growing companies around the world and send over 30 million emails each day. They understand that transactional emails are the heart of your customer relationships. Their email deliverability experts are constantly at work optimizing the reliability and speed of their SMTP infrastructure. Sendinblue provides users 300 free emails per day.', 'wp-mail-smtp' ) .
32
+ '<br><br>' .
33
+ /* translators: %2$s - URL to wpmailsmtp.com doc. */
34
+ __( 'Read our <a href="%2$s" target="_blank" rel="noopener noreferrer">Sendinblue documentation</a> to learn how to configure Sendinblue and improve your email deliverability.', 'wp-mail-smtp' ),
35
+ array(
36
+ 'br' => true,
37
+ 'strong' => true,
38
+ 'a' => array(
39
+ 'href' => true,
40
+ 'rel' => true,
41
+ 'target' => true,
42
+ ),
43
+ )
44
+ ),
45
+ 'https://wpmailsmtp.com/go/sendinblue/',
46
+ 'https://wpmailsmtp.com/docs/how-to-set-up-the-sendinblue-mailer-in-wp-mail-smtp'
47
+ );
48
+
49
+ $api_key = PluginOptions::init()->get( self::SLUG, 'api_key' );
50
+
51
+ if ( empty( $api_key ) ) {
52
+ $description .= '</p><p class="buttonned"><a href="https://wpmailsmtp.com/go/sendinblue/" target="_blank" rel="noopener noreferrer" class="wp-mail-smtp-btn wp-mail-smtp-btn-md wp-mail-smtp-btn-blueish">' .
53
+ esc_html__( 'Get Sendinblue Now (Free)', 'wp-mail-smtp' ) .
54
+ '</a></p>';
55
+ }
56
+
57
+ parent::__construct(
58
+ array(
59
+ 'logo_url' => wp_mail_smtp()->assets_url . '/images/sendinblue.svg',
60
+ 'slug' => self::SLUG,
61
+ 'title' => esc_html__( 'Sendinblue', 'wp-mail-smtp' ),
62
+ 'description' => $description,
63
+ 'recommended' => true,
64
+ 'php' => '5.6',
65
+ )
66
+ );
67
+ }
68
+
69
+ /**
70
+ * Output the mailer provider options.
71
+ *
72
+ * @since 1.6.0
73
+ */
74
+ public function display_options() {
75
+
76
+ // Do not display options if PHP version is not correct.
77
+ if ( ! $this->is_php_correct() ) {
78
+ $this->display_php_warning();
79
+
80
+ return;
81
+ }
82
+ ?>
83
+
84
+ <!-- API Key -->
85
+ <div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-client_id"
86
+ class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
87
+ <div class="wp-mail-smtp-setting-label">
88
+ <label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"><?php esc_html_e( 'API Key', 'wp-mail-smtp' ); ?></label>
89
+ </div>
90
+ <div class="wp-mail-smtp-setting-field">
91
+ <?php if ( $this->options->is_const_defined( $this->get_slug(), 'api_key' ) ) : ?>
92
+ <input type="text" disabled value="****************************************"
93
+ id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
94
+ />
95
+ <?php $this->display_const_set_message( 'WPMS_SENDINBLUE_API_KEY' ); ?>
96
+ <?php else : ?>
97
+ <input type="password" spellcheck="false"
98
+ name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][api_key]"
99
+ value="<?php echo esc_attr( $this->options->get( $this->get_slug(), 'api_key' ) ); ?>"
100
+ id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
101
+ />
102
+ <?php endif; ?>
103
+
104
+ <p class="desc">
105
+ <?php
106
+ printf( /* translators: %s - sendinblue.com link to get an API Key. */
107
+ esc_html__( 'Follow this link to get an API Key: %s.', 'wp-mail-smtp' ),
108
+ '<a href="https://account.sendinblue.com/advanced/api" target="_blank" rel="noopener noreferrer">' .
109
+ esc_html__( 'Get v3 API Key', 'wp-mail-smtp' ) .
110
+ '</a>'
111
+ );
112
+ ?>
113
+ </p>
114
+ </div>
115
+ </div>
116
+
117
+ <?php
118
+ }
119
+ }
vendor/composer/autoload_psr4.php CHANGED
@@ -9,6 +9,7 @@ return array(
9
  'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
10
  'Wikimedia\\Composer\\' => array($vendorDir . '/wikimedia/composer-merge-plugin/src'),
11
  'WPMailSMTP\\' => array($baseDir . '/src'),
 
12
  'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
13
  'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
14
  'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
9
  'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
10
  'Wikimedia\\Composer\\' => array($vendorDir . '/wikimedia/composer-merge-plugin/src'),
11
  'WPMailSMTP\\' => array($baseDir . '/src'),
12
+ 'SendinBlue\\Client\\' => array($vendorDir . '/sendinblue/api-v3-sdk/lib'),
13
  'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
14
  'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
15
  'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
vendor/composer/autoload_static.php CHANGED
@@ -24,6 +24,10 @@ class ComposerStaticInit84925637ca46a89b245a3fe4d9646ae4
24
  'Wikimedia\\Composer\\' => 19,
25
  'WPMailSMTP\\' => 11,
26
  ),
 
 
 
 
27
  'P' =>
28
  array (
29
  'Psr\\Log\\' => 8,
@@ -64,6 +68,10 @@ class ComposerStaticInit84925637ca46a89b245a3fe4d9646ae4
64
  array (
65
  0 => __DIR__ . '/../..' . '/src',
66
  ),
 
 
 
 
67
  'Psr\\Log\\' =>
68
  array (
69
  0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
24
  'Wikimedia\\Composer\\' => 19,
25
  'WPMailSMTP\\' => 11,
26
  ),
27
+ 'S' =>
28
+ array (
29
+ 'SendinBlue\\Client\\' => 18,
30
+ ),
31
  'P' =>
32
  array (
33
  'Psr\\Log\\' => 8,
68
  array (
69
  0 => __DIR__ . '/../..' . '/src',
70
  ),
71
+ 'SendinBlue\\Client\\' =>
72
+ array (
73
+ 0 => __DIR__ . '/..' . '/sendinblue/api-v3-sdk/lib',
74
+ ),
75
  'Psr\\Log\\' =>
76
  array (
77
  0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
vendor/google/apiclient-services/src/Google/Service/Gmail.php CHANGED
@@ -78,12 +78,13 @@ class Google_Service_Gmail extends Google_Service
78
  /**
79
  * Constructs the internal representation of the Gmail service.
80
  *
81
- * @param Google_Client $client
 
82
  */
83
- public function __construct(Google_Client $client)
84
  {
85
  parent::__construct($client);
86
- $this->rootUrl = 'https://www.googleapis.com/';
87
  $this->servicePath = 'gmail/v1/users/';
88
  $this->batchPath = 'batch/gmail/v1';
89
  $this->version = 'v1';
78
  /**
79
  * Constructs the internal representation of the Gmail service.
80
  *
81
+ * @param Google_Client $client The client used to deliver requests.
82
+ * @param string $rootUrl The root URL used for requests to the service.
83
  */
84
+ public function __construct(Google_Client $client, $rootUrl = null)
85
  {
86
  parent::__construct($client);
87
+ $this->rootUrl = $rootUrl ?: 'https://www.googleapis.com/';
88
  $this->servicePath = 'gmail/v1/users/';
89
  $this->batchPath = 'batch/gmail/v1';
90
  $this->version = 'v1';
vendor/google/auth/src/Cache/SysVCacheItemPool.php CHANGED
@@ -54,54 +54,10 @@ class SysVCacheItemPool implements CacheItemPoolInterface
54
  */
55
  private $options;
56
 
57
- /**
58
- * Save the current items.
59
- *
60
- * @return bool true when success, false upon failure
61
  */
62
- private function saveCurrentItems()
63
- {
64
- $shmid = shm_attach(
65
- $this->sysvKey,
66
- $this->options['memsize'],
67
- $this->options['perm']
68
- );
69
- if ($shmid !== false) {
70
- $ret = shm_put_var(
71
- $shmid,
72
- $this->options['variableKey'],
73
- $this->items
74
- );
75
- shm_detach($shmid);
76
- return $ret;
77
- }
78
- return false;
79
- }
80
-
81
- /**
82
- * Load the items from the shared memory.
83
- *
84
- * @return bool true when success, false upon failure
85
- */
86
- private function loadItems()
87
- {
88
- $shmid = shm_attach(
89
- $this->sysvKey,
90
- $this->options['memsize'],
91
- $this->options['perm']
92
- );
93
- if ($shmid !== false) {
94
- $data = @shm_get_var($shmid, $this->options['variableKey']);
95
- if (!empty($data)) {
96
- $this->items = $data;
97
- } else {
98
- $this->items = [];
99
- }
100
- shm_detach($shmid);
101
- return true;
102
- }
103
- return false;
104
- }
105
 
106
  /**
107
  * Create a SystemV shared memory based CacheItemPool.
@@ -132,7 +88,6 @@ class SysVCacheItemPool implements CacheItemPoolInterface
132
  $this->items = [];
133
  $this->deferredItems = [];
134
  $this->sysvKey = ftok(__FILE__, $this->options['proj']);
135
- $this->loadItems();
136
  }
137
 
138
  /**
@@ -191,6 +146,10 @@ class SysVCacheItemPool implements CacheItemPoolInterface
191
  */
192
  public function deleteItems(array $keys)
193
  {
 
 
 
 
194
  foreach ($keys as $key) {
195
  unset($this->items[$key]);
196
  }
@@ -202,6 +161,10 @@ class SysVCacheItemPool implements CacheItemPoolInterface
202
  */
203
  public function save(CacheItemInterface $item)
204
  {
 
 
 
 
205
  $this->items[$item->getKey()] = $item;
206
  return $this->saveCurrentItems();
207
  }
@@ -228,4 +191,54 @@ class SysVCacheItemPool implements CacheItemPoolInterface
228
  $this->deferredItems = [];
229
  return true;
230
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  }
54
  */
55
  private $options;
56
 
57
+ /*
58
+ * @var bool
 
 
59
  */
60
+ private $hasLoadedItems = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  /**
63
  * Create a SystemV shared memory based CacheItemPool.
88
  $this->items = [];
89
  $this->deferredItems = [];
90
  $this->sysvKey = ftok(__FILE__, $this->options['proj']);
 
91
  }
92
 
93
  /**
146
  */
147
  public function deleteItems(array $keys)
148
  {
149
+ if (!$this->hasLoadedItems) {
150
+ $this->loadItems();
151
+ }
152
+
153
  foreach ($keys as $key) {
154
  unset($this->items[$key]);
155
  }
161
  */
162
  public function save(CacheItemInterface $item)
163
  {
164
+ if (!$this->hasLoadedItems) {
165
+ $this->loadItems();
166
+ }
167
+
168
  $this->items[$item->getKey()] = $item;
169
  return $this->saveCurrentItems();
170
  }
191
  $this->deferredItems = [];
192
  return true;
193
  }
194
+
195
+ /**
196
+ * Save the current items.
197
+ *
198
+ * @return bool true when success, false upon failure
199
+ */
200
+ private function saveCurrentItems()
201
+ {
202
+ $shmid = shm_attach(
203
+ $this->sysvKey,
204
+ $this->options['memsize'],
205
+ $this->options['perm']
206
+ );
207
+ if ($shmid !== false) {
208
+ $ret = shm_put_var(
209
+ $shmid,
210
+ $this->options['variableKey'],
211
+ $this->items
212
+ );
213
+ shm_detach($shmid);
214
+ return $ret;
215
+ }
216
+ return false;
217
+ }
218
+
219
+ /**
220
+ * Load the items from the shared memory.
221
+ *
222
+ * @return bool true when success, false upon failure
223
+ */
224
+ private function loadItems()
225
+ {
226
+ $shmid = shm_attach(
227
+ $this->sysvKey,
228
+ $this->options['memsize'],
229
+ $this->options['perm']
230
+ );
231
+ if ($shmid !== false) {
232
+ $data = @shm_get_var($shmid, $this->options['variableKey']);
233
+ if (!empty($data)) {
234
+ $this->items = $data;
235
+ } else {
236
+ $this->items = [];
237
+ }
238
+ shm_detach($shmid);
239
+ $this->hasLoadedItems = true;
240
+ return true;
241
+ }
242
+ return false;
243
+ }
244
  }
vendor/google/auth/src/Credentials/GCECredentials.php CHANGED
@@ -189,7 +189,11 @@ class GCECredentials extends CredentialsLoader implements SignBlobInterface
189
  // the metadata resolution was particularly slow. The latter case is
190
  // "unlikely".
191
  $resp = $httpHandler(
192
- new Request('GET', $checkUri),
 
 
 
 
193
  ['timeout' => self::COMPUTE_PING_CONNECTION_TIMEOUT_S]
194
  );
195
 
@@ -340,7 +344,7 @@ class GCECredentials extends CredentialsLoader implements SignBlobInterface
340
  new Request(
341
  'GET',
342
  $uri,
343
- [GCECredentials::FLAVOR_HEADER => 'Google']
344
  )
345
  );
346
 
189
  // the metadata resolution was particularly slow. The latter case is
190
  // "unlikely".
191
  $resp = $httpHandler(
192
+ new Request(
193
+ 'GET',
194
+ $checkUri,
195
+ [self::FLAVOR_HEADER => 'Google']
196
+ ),
197
  ['timeout' => self::COMPUTE_PING_CONNECTION_TIMEOUT_S]
198
  );
199
 
344
  new Request(
345
  'GET',
346
  $uri,
347
+ [self::FLAVOR_HEADER => 'Google']
348
  )
349
  );
350
 
vendor/sendinblue/api-v3-sdk/lib/Api/AccountApi.php ADDED
@@ -0,0 +1,356 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * AccountApi
4
+ * PHP version 5
5
+ *
6
+ * @category Class
7
+ * @package SendinBlue\Client
8
+ * @author Swagger Codegen team
9
+ * @link https://github.com/swagger-api/swagger-codegen
10
+ */
11
+
12
+ /**
13
+ * SendinBlue API
14
+ *
15
+ * SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
16
+ *
17
+ * OpenAPI spec version: 3.0.0
18
+ * Contact: contact@sendinblue.com
19
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
20
+ * Swagger Codegen version: 2.3.1
21
+ */
22
+
23
+ /**
24
+ * NOTE: This class is auto generated by the swagger code generator program.
25
+ * https://github.com/swagger-api/swagger-codegen
26
+ * Do not edit the class manually.
27
+ */
28
+
29
+ namespace SendinBlue\Client\Api;
30
+
31
+ use GuzzleHttp\Client;
32
+ use GuzzleHttp\ClientInterface;
33
+ use GuzzleHttp\Exception\RequestException;
34
+ use GuzzleHttp\Psr7\MultipartStream;
35
+ use GuzzleHttp\Psr7\Request;
36
+ use GuzzleHttp\RequestOptions;
37
+ use SendinBlue\Client\ApiException;
38
+ use SendinBlue\Client\Configuration;
39
+ use SendinBlue\Client\HeaderSelector;
40
+ use SendinBlue\Client\ObjectSerializer;
41
+
42
+ /**
43
+ * AccountApi Class Doc Comment
44
+ *
45
+ * @category Class
46
+ * @package SendinBlue\Client
47
+ * @author Swagger Codegen team
48
+ * @link https://github.com/swagger-api/swagger-codegen
49
+ */
50
+ class AccountApi
51
+ {
52
+ /**
53
+ * @var ClientInterface
54
+ */
55
+ protected $client;
56
+
57
+ /**
58
+ * @var Configuration
59
+ */
60
+ protected $config;
61
+
62
+ /**
63
+ * @param ClientInterface $client
64
+ * @param Configuration $config
65
+ * @param HeaderSelector $selector
66
+ */
67
+ public function __construct(
68
+ ClientInterface $client = null,
69
+ Configuration $config = null,
70
+ HeaderSelector $selector = null
71
+ ) {
72
+ $this->client = $client ?: new Client();
73
+ $this->config = $config ?: new Configuration();
74
+ $this->headerSelector = $selector ?: new HeaderSelector();
75
+ }
76
+
77
+ /**
78
+ * @return Configuration
79
+ */
80
+ public function getConfig()
81
+ {
82
+ return $this->config;
83
+ }
84
+
85
+ /**
86
+ * Operation getAccount
87
+ *
88
+ * Get your account informations, plans and credits details
89
+ *
90
+ *
91
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
92
+ * @throws \InvalidArgumentException
93
+ * @return \SendinBlue\Client\Model\GetAccount
94
+ */
95
+ public function getAccount()
96
+ {
97
+ list($response) = $this->getAccountWithHttpInfo();
98
+ return $response;
99
+ }
100
+
101
+ /**
102
+ * Operation getAccountWithHttpInfo
103
+ *
104
+ * Get your account informations, plans and credits details
105
+ *
106
+ *
107
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
108
+ * @throws \InvalidArgumentException
109
+ * @return array of \SendinBlue\Client\Model\GetAccount, HTTP status code, HTTP response headers (array of strings)
110
+ */
111
+ public function getAccountWithHttpInfo()
112
+ {
113
+ $returnType = '\SendinBlue\Client\Model\GetAccount';
114
+ $request = $this->getAccountRequest();
115
+
116
+ try {
117
+ $options = $this->createHttpClientOption();
118
+ try {
119
+ $response = $this->client->send($request, $options);
120
+ } catch (RequestException $e) {
121
+ throw new ApiException(
122
+ "[{$e->getCode()}] {$e->getMessage()}",
123
+ $e->getCode(),
124
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
125
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
126
+ );
127
+ }
128
+
129
+ $statusCode = $response->getStatusCode();
130
+
131
+ if ($statusCode < 200 || $statusCode > 299) {
132
+ throw new ApiException(
133
+ sprintf(
134
+ '[%d] Error connecting to the API (%s)',
135
+ $statusCode,
136
+ $request->getUri()
137
+ ),
138
+ $statusCode,
139
+ $response->getHeaders(),
140
+ $response->getBody()
141
+ );
142
+ }
143
+
144
+ $responseBody = $response->getBody();
145
+ if ($returnType === '\SplFileObject') {
146
+ $content = $responseBody; //stream goes to serializer
147
+ } else {
148
+ $content = $responseBody->getContents();
149
+ if ($returnType !== 'string') {
150
+ $content = json_decode($content);
151
+ }
152
+ }
153
+
154
+ return [
155
+ ObjectSerializer::deserialize($content, $returnType, []),
156
+ $response->getStatusCode(),
157
+ $response->getHeaders()
158
+ ];
159
+
160
+ } catch (ApiException $e) {
161
+ switch ($e->getCode()) {
162
+ case 200:
163
+ $data = ObjectSerializer::deserialize(
164
+ $e->getResponseBody(),
165
+ '\SendinBlue\Client\Model\GetAccount',
166
+ $e->getResponseHeaders()
167
+ );
168
+ $e->setResponseObject($data);
169
+ break;
170
+ }
171
+ throw $e;
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Operation getAccountAsync
177
+ *
178
+ * Get your account informations, plans and credits details
179
+ *
180
+ *
181
+ * @throws \InvalidArgumentException
182
+ * @return \GuzzleHttp\Promise\PromiseInterface
183
+ */
184
+ public function getAccountAsync()
185
+ {
186
+ return $this->getAccountAsyncWithHttpInfo()
187
+ ->then(
188
+ function ($response) {
189
+ return $response[0];
190
+ }
191
+ );
192
+ }
193
+
194
+ /**
195
+ * Operation getAccountAsyncWithHttpInfo
196
+ *
197
+ * Get your account informations, plans and credits details
198
+ *
199
+ *
200
+ * @throws \InvalidArgumentException
201
+ * @return \GuzzleHttp\Promise\PromiseInterface
202
+ */
203
+ public function getAccountAsyncWithHttpInfo()
204
+ {
205
+ $returnType = '\SendinBlue\Client\Model\GetAccount';
206
+ $request = $this->getAccountRequest();
207
+
208
+ return $this->client
209
+ ->sendAsync($request, $this->createHttpClientOption())
210
+ ->then(
211
+ function ($response) use ($returnType) {
212
+ $responseBody = $response->getBody();
213
+ if ($returnType === '\SplFileObject') {
214
+ $content = $responseBody; //stream goes to serializer
215
+ } else {
216
+ $content = $responseBody->getContents();
217
+ if ($returnType !== 'string') {
218
+ $content = json_decode($content);
219
+ }
220
+ }
221
+
222
+ return [
223
+ ObjectSerializer::deserialize($content, $returnType, []),
224
+ $response->getStatusCode(),
225
+ $response->getHeaders()
226
+ ];
227
+ },
228
+ function ($exception) {
229
+ $response = $exception->getResponse();
230
+ $statusCode = $response->getStatusCode();
231
+ throw new ApiException(
232
+ sprintf(
233
+ '[%d] Error connecting to the API (%s)',
234
+ $statusCode,
235
+ $exception->getRequest()->getUri()
236
+ ),
237
+ $statusCode,
238
+ $response->getHeaders(),
239
+ $response->getBody()
240
+ );
241
+ }
242
+ );
243
+ }
244
+
245
+ /**
246
+ * Create request for operation 'getAccount'
247
+ *
248
+ *
249
+ * @throws \InvalidArgumentException
250
+ * @return \GuzzleHttp\Psr7\Request
251
+ */
252
+ protected function getAccountRequest()
253
+ {
254
+
255
+ $resourcePath = '/account';
256
+ $formParams = [];
257
+ $queryParams = [];
258
+ $headerParams = [];
259
+ $httpBody = '';
260
+ $multipart = false;
261
+
262
+
263
+
264
+ // body params
265
+ $_tempBody = null;
266
+
267
+ if ($multipart) {
268
+ $headers = $this->headerSelector->selectHeadersForMultipart(
269
+ ['application/json']
270
+ );
271
+ } else {
272
+ $headers = $this->headerSelector->selectHeaders(
273
+ ['application/json'],
274
+ ['application/json']
275
+ );
276
+ }
277
+
278
+ // for model (json/xml)
279
+ if (isset($_tempBody)) {
280
+ // $_tempBody is the method argument, if present
281
+ $httpBody = $_tempBody;
282
+ // \stdClass has no __toString(), so we should encode it manually
283
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
284
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
285
+ }
286
+ } elseif (count($formParams) > 0) {
287
+ if ($multipart) {
288
+ $multipartContents = [];
289
+ foreach ($formParams as $formParamName => $formParamValue) {
290
+ $multipartContents[] = [
291
+ 'name' => $formParamName,
292
+ 'contents' => $formParamValue
293
+ ];
294
+ }
295
+ // for HTTP post (form)
296
+ $httpBody = new MultipartStream($multipartContents);
297
+
298
+ } elseif ($headers['Content-Type'] === 'application/json') {
299
+ $httpBody = \GuzzleHttp\json_encode($formParams);
300
+
301
+ } else {
302
+ // for HTTP post (form)
303
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
304
+ }
305
+ }
306
+
307
+ // this endpoint requires API key authentication
308
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
309
+ if ($apiKey !== null) {
310
+ $headers['api-key'] = $apiKey;
311
+ }
312
+ // this endpoint requires API key authentication
313
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
314
+ if ($apiKey !== null) {
315
+ $headers['partner-key'] = $apiKey;
316
+ }
317
+
318
+ $defaultHeaders = [];
319
+ if ($this->config->getUserAgent()) {
320
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
321
+ }
322
+
323
+ $headers = array_merge(
324
+ $defaultHeaders,
325
+ $headerParams,
326
+ $headers
327
+ );
328
+
329
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
330
+ return new Request(
331
+ 'GET',
332
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
333
+ $headers,
334
+ $httpBody
335
+ );
336
+ }
337
+
338
+ /**
339
+ * Create http client option
340
+ *
341
+ * @throws \RuntimeException on file opening failure
342
+ * @return array of http client options
343
+ */
344
+ protected function createHttpClientOption()
345
+ {
346
+ $options = [];
347
+ if ($this->config->getDebug()) {
348
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
349
+ if (!$options[RequestOptions::DEBUG]) {
350
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
351
+ }
352
+ }
353
+
354
+ return $options;
355
+ }
356
+ }
vendor/sendinblue/api-v3-sdk/lib/Api/AttributesApi.php ADDED
@@ -0,0 +1,1186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * AttributesApi
4
+ * PHP version 5
5
+ *
6
+ * @category Class
7
+ * @package SendinBlue\Client
8
+ * @author Swagger Codegen team
9
+ * @link https://github.com/swagger-api/swagger-codegen
10
+ */
11
+
12
+ /**
13
+ * SendinBlue API
14
+ *
15
+ * SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
16
+ *
17
+ * OpenAPI spec version: 3.0.0
18
+ * Contact: contact@sendinblue.com
19
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
20
+ * Swagger Codegen version: 2.3.1
21
+ */
22
+
23
+ /**
24
+ * NOTE: This class is auto generated by the swagger code generator program.
25
+ * https://github.com/swagger-api/swagger-codegen
26
+ * Do not edit the class manually.
27
+ */
28
+
29
+ namespace SendinBlue\Client\Api;
30
+
31
+ use GuzzleHttp\Client;
32
+ use GuzzleHttp\ClientInterface;
33
+ use GuzzleHttp\Exception\RequestException;
34
+ use GuzzleHttp\Psr7\MultipartStream;
35
+ use GuzzleHttp\Psr7\Request;
36
+ use GuzzleHttp\RequestOptions;
37
+ use SendinBlue\Client\ApiException;
38
+ use SendinBlue\Client\Configuration;
39
+ use SendinBlue\Client\HeaderSelector;
40
+ use SendinBlue\Client\ObjectSerializer;
41
+
42
+ /**
43
+ * AttributesApi Class Doc Comment
44
+ *
45
+ * @category Class
46
+ * @package SendinBlue\Client
47
+ * @author Swagger Codegen team
48
+ * @link https://github.com/swagger-api/swagger-codegen
49
+ */
50
+ class AttributesApi
51
+ {
52
+ /**
53
+ * @var ClientInterface
54
+ */
55
+ protected $client;
56
+
57
+ /**
58
+ * @var Configuration
59
+ */
60
+ protected $config;
61
+
62
+ /**
63
+ * @param ClientInterface $client
64
+ * @param Configuration $config
65
+ * @param HeaderSelector $selector
66
+ */
67
+ public function __construct(
68
+ ClientInterface $client = null,
69
+ Configuration $config = null,
70
+ HeaderSelector $selector = null
71
+ ) {
72
+ $this->client = $client ?: new Client();
73
+ $this->config = $config ?: new Configuration();
74
+ $this->headerSelector = $selector ?: new HeaderSelector();
75
+ }
76
+
77
+ /**
78
+ * @return Configuration
79
+ */
80
+ public function getConfig()
81
+ {
82
+ return $this->config;
83
+ }
84
+
85
+ /**
86
+ * Operation createAttribute
87
+ *
88
+ * Creates contact attribute
89
+ *
90
+ * @param string $attributeCategory Category of the attribute (required)
91
+ * @param string $attributeName Name of the attribute (required)
92
+ * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required)
93
+ *
94
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
95
+ * @throws \InvalidArgumentException
96
+ * @return void
97
+ */
98
+ public function createAttribute($attributeCategory, $attributeName, $createAttribute)
99
+ {
100
+ $this->createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute);
101
+ }
102
+
103
+ /**
104
+ * Operation createAttributeWithHttpInfo
105
+ *
106
+ * Creates contact attribute
107
+ *
108
+ * @param string $attributeCategory Category of the attribute (required)
109
+ * @param string $attributeName Name of the attribute (required)
110
+ * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required)
111
+ *
112
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
113
+ * @throws \InvalidArgumentException
114
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
115
+ */
116
+ public function createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute)
117
+ {
118
+ $returnType = '';
119
+ $request = $this->createAttributeRequest($attributeCategory, $attributeName, $createAttribute);
120
+
121
+ try {
122
+ $options = $this->createHttpClientOption();
123
+ try {
124
+ $response = $this->client->send($request, $options);
125
+ } catch (RequestException $e) {
126
+ throw new ApiException(
127
+ "[{$e->getCode()}] {$e->getMessage()}",
128
+ $e->getCode(),
129
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
130
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
131
+ );
132
+ }
133
+
134
+ $statusCode = $response->getStatusCode();
135
+
136
+ if ($statusCode < 200 || $statusCode > 299) {
137
+ throw new ApiException(
138
+ sprintf(
139
+ '[%d] Error connecting to the API (%s)',
140
+ $statusCode,
141
+ $request->getUri()
142
+ ),
143
+ $statusCode,
144
+ $response->getHeaders(),
145
+ $response->getBody()
146
+ );
147
+ }
148
+
149
+ return [null, $statusCode, $response->getHeaders()];
150
+
151
+ } catch (ApiException $e) {
152
+ switch ($e->getCode()) {
153
+ case 400:
154
+ $data = ObjectSerializer::deserialize(
155
+ $e->getResponseBody(),
156
+ '\SendinBlue\Client\Model\ErrorModel',
157
+ $e->getResponseHeaders()
158
+ );
159
+ $e->setResponseObject($data);
160
+ break;
161
+ }
162
+ throw $e;
163
+ }
164
+ }
165
+
166
+ /**
167
+ * Operation createAttributeAsync
168
+ *
169
+ * Creates contact attribute
170
+ *
171
+ * @param string $attributeCategory Category of the attribute (required)
172
+ * @param string $attributeName Name of the attribute (required)
173
+ * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required)
174
+ *
175
+ * @throws \InvalidArgumentException
176
+ * @return \GuzzleHttp\Promise\PromiseInterface
177
+ */
178
+ public function createAttributeAsync($attributeCategory, $attributeName, $createAttribute)
179
+ {
180
+ return $this->createAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $createAttribute)
181
+ ->then(
182
+ function ($response) {
183
+ return $response[0];
184
+ }
185
+ );
186
+ }
187
+
188
+ /**
189
+ * Operation createAttributeAsyncWithHttpInfo
190
+ *
191
+ * Creates contact attribute
192
+ *
193
+ * @param string $attributeCategory Category of the attribute (required)
194
+ * @param string $attributeName Name of the attribute (required)
195
+ * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required)
196
+ *
197
+ * @throws \InvalidArgumentException
198
+ * @return \GuzzleHttp\Promise\PromiseInterface
199
+ */
200
+ public function createAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $createAttribute)
201
+ {
202
+ $returnType = '';
203
+ $request = $this->createAttributeRequest($attributeCategory, $attributeName, $createAttribute);
204
+
205
+ return $this->client
206
+ ->sendAsync($request, $this->createHttpClientOption())
207
+ ->then(
208
+ function ($response) use ($returnType) {
209
+ return [null, $response->getStatusCode(), $response->getHeaders()];
210
+ },
211
+ function ($exception) {
212
+ $response = $exception->getResponse();
213
+ $statusCode = $response->getStatusCode();
214
+ throw new ApiException(
215
+ sprintf(
216
+ '[%d] Error connecting to the API (%s)',
217
+ $statusCode,
218
+ $exception->getRequest()->getUri()
219
+ ),
220
+ $statusCode,
221
+ $response->getHeaders(),
222
+ $response->getBody()
223
+ );
224
+ }
225
+ );
226
+ }
227
+
228
+ /**
229
+ * Create request for operation 'createAttribute'
230
+ *
231
+ * @param string $attributeCategory Category of the attribute (required)
232
+ * @param string $attributeName Name of the attribute (required)
233
+ * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required)
234
+ *
235
+ * @throws \InvalidArgumentException
236
+ * @return \GuzzleHttp\Psr7\Request
237
+ */
238
+ protected function createAttributeRequest($attributeCategory, $attributeName, $createAttribute)
239
+ {
240
+ // verify the required parameter 'attributeCategory' is set
241
+ if ($attributeCategory === null) {
242
+ throw new \InvalidArgumentException(
243
+ 'Missing the required parameter $attributeCategory when calling createAttribute'
244
+ );
245
+ }
246
+ // verify the required parameter 'attributeName' is set
247
+ if ($attributeName === null) {
248
+ throw new \InvalidArgumentException(
249
+ 'Missing the required parameter $attributeName when calling createAttribute'
250
+ );
251
+ }
252
+ // verify the required parameter 'createAttribute' is set
253
+ if ($createAttribute === null) {
254
+ throw new \InvalidArgumentException(
255
+ 'Missing the required parameter $createAttribute when calling createAttribute'
256
+ );
257
+ }
258
+
259
+ $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}';
260
+ $formParams = [];
261
+ $queryParams = [];
262
+ $headerParams = [];
263
+ $httpBody = '';
264
+ $multipart = false;
265
+
266
+
267
+ // path params
268
+ if ($attributeCategory !== null) {
269
+ $resourcePath = str_replace(
270
+ '{' . 'attributeCategory' . '}',
271
+ ObjectSerializer::toPathValue($attributeCategory),
272
+ $resourcePath
273
+ );
274
+ }
275
+ // path params
276
+ if ($attributeName !== null) {
277
+ $resourcePath = str_replace(
278
+ '{' . 'attributeName' . '}',
279
+ ObjectSerializer::toPathValue($attributeName),
280
+ $resourcePath
281
+ );
282
+ }
283
+
284
+ // body params
285
+ $_tempBody = null;
286
+ if (isset($createAttribute)) {
287
+ $_tempBody = $createAttribute;
288
+ }
289
+
290
+ if ($multipart) {
291
+ $headers = $this->headerSelector->selectHeadersForMultipart(
292
+ ['application/json']
293
+ );
294
+ } else {
295
+ $headers = $this->headerSelector->selectHeaders(
296
+ ['application/json'],
297
+ ['application/json']
298
+ );
299
+ }
300
+
301
+ // for model (json/xml)
302
+ if (isset($_tempBody)) {
303
+ // $_tempBody is the method argument, if present
304
+ $httpBody = $_tempBody;
305
+ // \stdClass has no __toString(), so we should encode it manually
306
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
307
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
308
+ }
309
+ } elseif (count($formParams) > 0) {
310
+ if ($multipart) {
311
+ $multipartContents = [];
312
+ foreach ($formParams as $formParamName => $formParamValue) {
313
+ $multipartContents[] = [
314
+ 'name' => $formParamName,
315
+ 'contents' => $formParamValue
316
+ ];
317
+ }
318
+ // for HTTP post (form)
319
+ $httpBody = new MultipartStream($multipartContents);
320
+
321
+ } elseif ($headers['Content-Type'] === 'application/json') {
322
+ $httpBody = \GuzzleHttp\json_encode($formParams);
323
+
324
+ } else {
325
+ // for HTTP post (form)
326
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
327
+ }
328
+ }
329
+
330
+ // this endpoint requires API key authentication
331
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
332
+ if ($apiKey !== null) {
333
+ $headers['api-key'] = $apiKey;
334
+ }
335
+ // this endpoint requires API key authentication
336
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
337
+ if ($apiKey !== null) {
338
+ $headers['partner-key'] = $apiKey;
339
+ }
340
+
341
+ $defaultHeaders = [];
342
+ if ($this->config->getUserAgent()) {
343
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
344
+ }
345
+
346
+ $headers = array_merge(
347
+ $defaultHeaders,
348
+ $headerParams,
349
+ $headers
350
+ );
351
+
352
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
353
+ return new Request(
354
+ 'POST',
355
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
356
+ $headers,
357
+ $httpBody
358
+ );
359
+ }
360
+
361
+ /**
362
+ * Operation deleteAttribute
363
+ *
364
+ * Deletes an attribute
365
+ *
366
+ * @param string $attributeCategory Category of the attribute (required)
367
+ * @param string $attributeName Name of the existing attribute (required)
368
+ *
369
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
370
+ * @throws \InvalidArgumentException
371
+ * @return void
372
+ */
373
+ public function deleteAttribute($attributeCategory, $attributeName)
374
+ {
375
+ $this->deleteAttributeWithHttpInfo($attributeCategory, $attributeName);
376
+ }
377
+
378
+ /**
379
+ * Operation deleteAttributeWithHttpInfo
380
+ *
381
+ * Deletes an attribute
382
+ *
383
+ * @param string $attributeCategory Category of the attribute (required)
384
+ * @param string $attributeName Name of the existing attribute (required)
385
+ *
386
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
387
+ * @throws \InvalidArgumentException
388
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
389
+ */
390
+ public function deleteAttributeWithHttpInfo($attributeCategory, $attributeName)
391
+ {
392
+ $returnType = '';
393
+ $request = $this->deleteAttributeRequest($attributeCategory, $attributeName);
394
+
395
+ try {
396
+ $options = $this->createHttpClientOption();
397
+ try {
398
+ $response = $this->client->send($request, $options);
399
+ } catch (RequestException $e) {
400
+ throw new ApiException(
401
+ "[{$e->getCode()}] {$e->getMessage()}",
402
+ $e->getCode(),
403
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
404
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
405
+ );
406
+ }
407
+
408
+ $statusCode = $response->getStatusCode();
409
+
410
+ if ($statusCode < 200 || $statusCode > 299) {
411
+ throw new ApiException(
412
+ sprintf(
413
+ '[%d] Error connecting to the API (%s)',
414
+ $statusCode,
415
+ $request->getUri()
416
+ ),
417
+ $statusCode,
418
+ $response->getHeaders(),
419
+ $response->getBody()
420
+ );
421
+ }
422
+
423
+ return [null, $statusCode, $response->getHeaders()];
424
+
425
+ } catch (ApiException $e) {
426
+ switch ($e->getCode()) {
427
+ case 400:
428
+ $data = ObjectSerializer::deserialize(
429
+ $e->getResponseBody(),
430
+ '\SendinBlue\Client\Model\ErrorModel',
431
+ $e->getResponseHeaders()
432
+ );
433
+ $e->setResponseObject($data);
434
+ break;
435
+ case 404:
436
+ $data = ObjectSerializer::deserialize(
437
+ $e->getResponseBody(),
438
+ '\SendinBlue\Client\Model\ErrorModel',
439
+ $e->getResponseHeaders()
440
+ );
441
+ $e->setResponseObject($data);
442
+ break;
443
+ }
444
+ throw $e;
445
+ }
446
+ }
447
+
448
+ /**
449
+ * Operation deleteAttributeAsync
450
+ *
451
+ * Deletes an attribute
452
+ *
453
+ * @param string $attributeCategory Category of the attribute (required)
454
+ * @param string $attributeName Name of the existing attribute (required)
455
+ *
456
+ * @throws \InvalidArgumentException
457
+ * @return \GuzzleHttp\Promise\PromiseInterface
458
+ */
459
+ public function deleteAttributeAsync($attributeCategory, $attributeName)
460
+ {
461
+ return $this->deleteAttributeAsyncWithHttpInfo($attributeCategory, $attributeName)
462
+ ->then(
463
+ function ($response) {
464
+ return $response[0];
465
+ }
466
+ );
467
+ }
468
+
469
+ /**
470
+ * Operation deleteAttributeAsyncWithHttpInfo
471
+ *
472
+ * Deletes an attribute
473
+ *
474
+ * @param string $attributeCategory Category of the attribute (required)
475
+ * @param string $attributeName Name of the existing attribute (required)
476
+ *
477
+ * @throws \InvalidArgumentException
478
+ * @return \GuzzleHttp\Promise\PromiseInterface
479
+ */
480
+ public function deleteAttributeAsyncWithHttpInfo($attributeCategory, $attributeName)
481
+ {
482
+ $returnType = '';
483
+ $request = $this->deleteAttributeRequest($attributeCategory, $attributeName);
484
+
485
+ return $this->client
486
+ ->sendAsync($request, $this->createHttpClientOption())
487
+ ->then(
488
+ function ($response) use ($returnType) {
489
+ return [null, $response->getStatusCode(), $response->getHeaders()];
490
+ },
491
+ function ($exception) {
492
+ $response = $exception->getResponse();
493
+ $statusCode = $response->getStatusCode();
494
+ throw new ApiException(
495
+ sprintf(
496
+ '[%d] Error connecting to the API (%s)',
497
+ $statusCode,
498
+ $exception->getRequest()->getUri()
499
+ ),
500
+ $statusCode,
501
+ $response->getHeaders(),
502
+ $response->getBody()
503
+ );
504
+ }
505
+ );
506
+ }
507
+
508
+ /**
509
+ * Create request for operation 'deleteAttribute'
510
+ *
511
+ * @param string $attributeCategory Category of the attribute (required)
512
+ * @param string $attributeName Name of the existing attribute (required)
513
+ *
514
+ * @throws \InvalidArgumentException
515
+ * @return \GuzzleHttp\Psr7\Request
516
+ */
517
+ protected function deleteAttributeRequest($attributeCategory, $attributeName)
518
+ {
519
+ // verify the required parameter 'attributeCategory' is set
520
+ if ($attributeCategory === null) {
521
+ throw new \InvalidArgumentException(
522
+ 'Missing the required parameter $attributeCategory when calling deleteAttribute'
523
+ );
524
+ }
525
+ // verify the required parameter 'attributeName' is set
526
+ if ($attributeName === null) {
527
+ throw new \InvalidArgumentException(
528
+ 'Missing the required parameter $attributeName when calling deleteAttribute'
529
+ );
530
+ }
531
+
532
+ $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}';
533
+ $formParams = [];
534
+ $queryParams = [];
535
+ $headerParams = [];
536
+ $httpBody = '';
537
+ $multipart = false;
538
+
539
+
540
+ // path params
541
+ if ($attributeCategory !== null) {
542
+ $resourcePath = str_replace(
543
+ '{' . 'attributeCategory' . '}',
544
+ ObjectSerializer::toPathValue($attributeCategory),
545
+ $resourcePath
546
+ );
547
+ }
548
+ // path params
549
+ if ($attributeName !== null) {
550
+ $resourcePath = str_replace(
551
+ '{' . 'attributeName' . '}',
552
+ ObjectSerializer::toPathValue($attributeName),
553
+ $resourcePath
554
+ );
555
+ }
556
+
557
+ // body params
558
+ $_tempBody = null;
559
+
560
+ if ($multipart) {
561
+ $headers = $this->headerSelector->selectHeadersForMultipart(
562
+ ['application/json']
563
+ );
564
+ } else {
565
+ $headers = $this->headerSelector->selectHeaders(
566
+ ['application/json'],
567
+ ['application/json']
568
+ );
569
+ }
570
+
571
+ // for model (json/xml)
572
+ if (isset($_tempBody)) {
573
+ // $_tempBody is the method argument, if present
574
+ $httpBody = $_tempBody;
575
+ // \stdClass has no __toString(), so we should encode it manually
576
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
577
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
578
+ }
579
+ } elseif (count($formParams) > 0) {
580
+ if ($multipart) {
581
+ $multipartContents = [];
582
+ foreach ($formParams as $formParamName => $formParamValue) {
583
+ $multipartContents[] = [
584
+ 'name' => $formParamName,
585
+ 'contents' => $formParamValue
586
+ ];
587
+ }
588
+ // for HTTP post (form)
589
+ $httpBody = new MultipartStream($multipartContents);
590
+
591
+ } elseif ($headers['Content-Type'] === 'application/json') {
592
+ $httpBody = \GuzzleHttp\json_encode($formParams);
593
+
594
+ } else {
595
+ // for HTTP post (form)
596
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
597
+ }
598
+ }
599
+
600
+ // this endpoint requires API key authentication
601
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
602
+ if ($apiKey !== null) {
603
+ $headers['api-key'] = $apiKey;
604
+ }
605
+ // this endpoint requires API key authentication
606
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
607
+ if ($apiKey !== null) {
608
+ $headers['partner-key'] = $apiKey;
609
+ }
610
+
611
+ $defaultHeaders = [];
612
+ if ($this->config->getUserAgent()) {
613
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
614
+ }
615
+
616
+ $headers = array_merge(
617
+ $defaultHeaders,
618
+ $headerParams,
619
+ $headers
620
+ );
621
+
622
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
623
+ return new Request(
624
+ 'DELETE',
625
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
626
+ $headers,
627
+ $httpBody
628
+ );
629
+ }
630
+
631
+ /**
632
+ * Operation getAttributes
633
+ *
634
+ * Lists all attributes
635
+ *
636
+ *
637
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
638
+ * @throws \InvalidArgumentException
639
+ * @return \SendinBlue\Client\Model\GetAttributes
640
+ */
641
+ public function getAttributes()
642
+ {
643
+ list($response) = $this->getAttributesWithHttpInfo();
644
+ return $response;
645
+ }
646
+
647
+ /**
648
+ * Operation getAttributesWithHttpInfo
649
+ *
650
+ * Lists all attributes
651
+ *
652
+ *
653
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
654
+ * @throws \InvalidArgumentException
655
+ * @return array of \SendinBlue\Client\Model\GetAttributes, HTTP status code, HTTP response headers (array of strings)
656
+ */
657
+ public function getAttributesWithHttpInfo()
658
+ {
659
+ $returnType = '\SendinBlue\Client\Model\GetAttributes';
660
+ $request = $this->getAttributesRequest();
661
+
662
+ try {
663
+ $options = $this->createHttpClientOption();
664
+ try {
665
+ $response = $this->client->send($request, $options);
666
+ } catch (RequestException $e) {
667
+ throw new ApiException(
668
+ "[{$e->getCode()}] {$e->getMessage()}",
669
+ $e->getCode(),
670
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
671
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
672
+ );
673
+ }
674
+
675
+ $statusCode = $response->getStatusCode();
676
+
677
+ if ($statusCode < 200 || $statusCode > 299) {
678
+ throw new ApiException(
679
+ sprintf(
680
+ '[%d] Error connecting to the API (%s)',
681
+ $statusCode,
682
+ $request->getUri()
683
+ ),
684
+ $statusCode,
685
+ $response->getHeaders(),
686
+ $response->getBody()
687
+ );
688
+ }
689
+
690
+ $responseBody = $response->getBody();
691
+ if ($returnType === '\SplFileObject') {
692
+ $content = $responseBody; //stream goes to serializer
693
+ } else {
694
+ $content = $responseBody->getContents();
695
+ if ($returnType !== 'string') {
696
+ $content = json_decode($content);
697
+ }
698
+ }
699
+
700
+ return [
701
+ ObjectSerializer::deserialize($content, $returnType, []),
702
+ $response->getStatusCode(),
703
+ $response->getHeaders()
704
+ ];
705
+
706
+ } catch (ApiException $e) {
707
+ switch ($e->getCode()) {
708
+ case 200:
709
+ $data = ObjectSerializer::deserialize(
710
+ $e->getResponseBody(),
711
+ '\SendinBlue\Client\Model\GetAttributes',
712
+ $e->getResponseHeaders()
713
+ );
714
+ $e->setResponseObject($data);
715
+ break;
716
+ }
717
+ throw $e;
718
+ }
719
+ }
720
+
721
+ /**
722
+ * Operation getAttributesAsync
723
+ *
724
+ * Lists all attributes
725
+ *
726
+ *
727
+ * @throws \InvalidArgumentException
728
+ * @return \GuzzleHttp\Promise\PromiseInterface
729
+ */
730
+ public function getAttributesAsync()
731
+ {
732
+ return $this->getAttributesAsyncWithHttpInfo()
733
+ ->then(
734
+ function ($response) {
735
+ return $response[0];
736
+ }
737
+ );
738
+ }
739
+
740
+ /**
741
+ * Operation getAttributesAsyncWithHttpInfo
742
+ *
743
+ * Lists all attributes
744
+ *
745
+ *
746
+ * @throws \InvalidArgumentException
747
+ * @return \GuzzleHttp\Promise\PromiseInterface
748
+ */
749
+ public function getAttributesAsyncWithHttpInfo()
750
+ {
751
+ $returnType = '\SendinBlue\Client\Model\GetAttributes';
752
+ $request = $this->getAttributesRequest();
753
+
754
+ return $this->client
755
+ ->sendAsync($request, $this->createHttpClientOption())
756
+ ->then(
757
+ function ($response) use ($returnType) {
758
+ $responseBody = $response->getBody();
759
+ if ($returnType === '\SplFileObject') {
760
+ $content = $responseBody; //stream goes to serializer
761
+ } else {
762
+ $content = $responseBody->getContents();
763
+ if ($returnType !== 'string') {
764
+ $content = json_decode($content);
765
+ }
766
+ }
767
+
768
+ return [
769
+ ObjectSerializer::deserialize($content, $returnType, []),
770
+ $response->getStatusCode(),
771
+ $response->getHeaders()
772
+ ];
773
+ },
774
+ function ($exception) {
775
+ $response = $exception->getResponse();
776
+ $statusCode = $response->getStatusCode();
777
+ throw new ApiException(
778
+ sprintf(
779
+ '[%d] Error connecting to the API (%s)',
780
+ $statusCode,
781
+ $exception->getRequest()->getUri()
782
+ ),
783
+ $statusCode,
784
+ $response->getHeaders(),
785
+ $response->getBody()
786
+ );
787
+ }
788
+ );
789
+ }
790
+
791
+ /**
792
+ * Create request for operation 'getAttributes'
793
+ *
794
+ *
795
+ * @throws \InvalidArgumentException
796
+ * @return \GuzzleHttp\Psr7\Request
797
+ */
798
+ protected function getAttributesRequest()
799
+ {
800
+
801
+ $resourcePath = '/contacts/attributes';
802
+ $formParams = [];
803
+ $queryParams = [];
804
+ $headerParams = [];
805
+ $httpBody = '';
806
+ $multipart = false;
807
+
808
+
809
+
810
+ // body params
811
+ $_tempBody = null;
812
+
813
+ if ($multipart) {
814
+ $headers = $this->headerSelector->selectHeadersForMultipart(
815
+ ['application/json']
816
+ );
817
+ } else {
818
+ $headers = $this->headerSelector->selectHeaders(
819
+ ['application/json'],
820
+ ['application/json']
821
+ );
822
+ }
823
+
824
+ // for model (json/xml)
825
+ if (isset($_tempBody)) {
826
+ // $_tempBody is the method argument, if present
827
+ $httpBody = $_tempBody;
828
+ // \stdClass has no __toString(), so we should encode it manually
829
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
830
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
831
+ }
832
+ } elseif (count($formParams) > 0) {
833
+ if ($multipart) {
834
+ $multipartContents = [];
835
+ foreach ($formParams as $formParamName => $formParamValue) {
836
+ $multipartContents[] = [
837
+ 'name' => $formParamName,
838
+ 'contents' => $formParamValue
839
+ ];
840
+ }
841
+ // for HTTP post (form)
842
+ $httpBody = new MultipartStream($multipartContents);
843
+
844
+ } elseif ($headers['Content-Type'] === 'application/json') {
845
+ $httpBody = \GuzzleHttp\json_encode($formParams);
846
+
847
+ } else {
848
+ // for HTTP post (form)
849
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
850
+ }
851
+ }
852
+
853
+ // this endpoint requires API key authentication
854
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
855
+ if ($apiKey !== null) {
856
+ $headers['api-key'] = $apiKey;
857
+ }
858
+ // this endpoint requires API key authentication
859
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
860
+ if ($apiKey !== null) {
861
+ $headers['partner-key'] = $apiKey;
862
+ }
863
+
864
+ $defaultHeaders = [];
865
+ if ($this->config->getUserAgent()) {
866
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
867
+ }
868
+
869
+ $headers = array_merge(
870
+ $defaultHeaders,
871
+ $headerParams,
872
+ $headers
873
+ );
874
+
875
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
876
+ return new Request(
877
+ 'GET',
878
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
879
+ $headers,
880
+ $httpBody
881
+ );
882
+ }
883
+
884
+ /**
885
+ * Operation updateAttribute
886
+ *
887
+ * Updates contact attribute
888
+ *
889
+ * @param string $attributeCategory Category of the attribute (required)
890
+ * @param string $attributeName Name of the existing attribute (required)
891
+ * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required)
892
+ *
893
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
894
+ * @throws \InvalidArgumentException
895
+ * @return void
896
+ */
897
+ public function updateAttribute($attributeCategory, $attributeName, $updateAttribute)
898
+ {
899
+ $this->updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute);
900
+ }
901
+
902
+ /**
903
+ * Operation updateAttributeWithHttpInfo
904
+ *
905
+ * Updates contact attribute
906
+ *
907
+ * @param string $attributeCategory Category of the attribute (required)
908
+ * @param string $attributeName Name of the existing attribute (required)
909
+ * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required)
910
+ *
911
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
912
+ * @throws \InvalidArgumentException
913
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
914
+ */
915
+ public function updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute)
916
+ {
917
+ $returnType = '';
918
+ $request = $this->updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute);
919
+
920
+ try {
921
+ $options = $this->createHttpClientOption();
922
+ try {
923
+ $response = $this->client->send($request, $options);
924
+ } catch (RequestException $e) {
925
+ throw new ApiException(
926
+ "[{$e->getCode()}] {$e->getMessage()}",
927
+ $e->getCode(),
928
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
929
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
930
+ );
931
+ }
932
+
933
+ $statusCode = $response->getStatusCode();
934
+
935
+ if ($statusCode < 200 || $statusCode > 299) {
936
+ throw new ApiException(
937
+ sprintf(
938
+ '[%d] Error connecting to the API (%s)',
939
+ $statusCode,
940
+ $request->getUri()
941
+ ),
942
+ $statusCode,
943
+ $response->getHeaders(),
944
+ $response->getBody()
945
+ );
946
+ }
947
+
948
+ return [null, $statusCode, $response->getHeaders()];
949
+
950
+ } catch (ApiException $e) {
951
+ switch ($e->getCode()) {
952
+ case 400:
953
+ $data = ObjectSerializer::deserialize(
954
+ $e->getResponseBody(),
955
+ '\SendinBlue\Client\Model\ErrorModel',
956
+ $e->getResponseHeaders()
957
+ );
958
+ $e->setResponseObject($data);
959
+ break;
960
+ case 404:
961
+ $data = ObjectSerializer::deserialize(
962
+ $e->getResponseBody(),
963
+ '\SendinBlue\Client\Model\ErrorModel',
964
+ $e->getResponseHeaders()
965
+ );
966
+ $e->setResponseObject($data);
967
+ break;
968
+ }
969
+ throw $e;
970
+ }
971
+ }
972
+
973
+ /**
974
+ * Operation updateAttributeAsync
975
+ *
976
+ * Updates contact attribute
977
+ *
978
+ * @param string $attributeCategory Category of the attribute (required)
979
+ * @param string $attributeName Name of the existing attribute (required)
980
+ * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required)
981
+ *
982
+ * @throws \InvalidArgumentException
983
+ * @return \GuzzleHttp\Promise\PromiseInterface
984
+ */
985
+ public function updateAttributeAsync($attributeCategory, $attributeName, $updateAttribute)
986
+ {
987
+ return $this->updateAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $updateAttribute)
988
+ ->then(
989
+ function ($response) {
990
+ return $response[0];
991
+ }
992
+ );
993
+ }
994
+
995
+ /**
996
+ * Operation updateAttributeAsyncWithHttpInfo
997
+ *
998
+ * Updates contact attribute
999
+ *
1000
+ * @param string $attributeCategory Category of the attribute (required)
1001
+ * @param string $attributeName Name of the existing attribute (required)
1002
+ * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required)
1003
+ *
1004
+ * @throws \InvalidArgumentException
1005
+ * @return \GuzzleHttp\Promise\PromiseInterface
1006
+ */
1007
+ public function updateAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $updateAttribute)
1008
+ {
1009
+ $returnType = '';
1010
+ $request = $this->updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute);
1011
+
1012
+ return $this->client
1013
+ ->sendAsync($request, $this->createHttpClientOption())
1014
+ ->then(
1015
+ function ($response) use ($returnType) {
1016
+ return [null, $response->getStatusCode(), $response->getHeaders()];
1017
+ },
1018
+ function ($exception) {
1019
+ $response = $exception->getResponse();
1020
+ $statusCode = $response->getStatusCode();
1021
+ throw new ApiException(
1022
+ sprintf(
1023
+ '[%d] Error connecting to the API (%s)',
1024
+ $statusCode,
1025
+ $exception->getRequest()->getUri()
1026
+ ),
1027
+ $statusCode,
1028
+ $response->getHeaders(),
1029
+ $response->getBody()
1030
+ );
1031
+ }
1032
+ );
1033
+ }
1034
+
1035
+ /**
1036
+ * Create request for operation 'updateAttribute'
1037
+ *
1038
+ * @param string $attributeCategory Category of the attribute (required)
1039
+ * @param string $attributeName Name of the existing attribute (required)
1040
+ * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required)
1041
+ *
1042
+ * @throws \InvalidArgumentException
1043
+ * @return \GuzzleHttp\Psr7\Request
1044
+ */
1045
+ protected function updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute)
1046
+ {
1047
+ // verify the required parameter 'attributeCategory' is set
1048
+ if ($attributeCategory === null) {
1049
+ throw new \InvalidArgumentException(
1050
+ 'Missing the required parameter $attributeCategory when calling updateAttribute'
1051
+ );
1052
+ }
1053
+ // verify the required parameter 'attributeName' is set
1054
+ if ($attributeName === null) {
1055
+ throw new \InvalidArgumentException(
1056
+ 'Missing the required parameter $attributeName when calling updateAttribute'
1057
+ );
1058
+ }
1059
+ // verify the required parameter 'updateAttribute' is set
1060
+ if ($updateAttribute === null) {
1061
+ throw new \InvalidArgumentException(
1062
+ 'Missing the required parameter $updateAttribute when calling updateAttribute'
1063
+ );
1064
+ }
1065
+
1066
+ $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}';
1067
+ $formParams = [];
1068
+ $queryParams = [];
1069
+ $headerParams = [];
1070
+ $httpBody = '';
1071
+ $multipart = false;
1072
+
1073
+
1074
+ // path params
1075
+ if ($attributeCategory !== null) {
1076
+ $resourcePath = str_replace(
1077
+ '{' . 'attributeCategory' . '}',
1078
+ ObjectSerializer::toPathValue($attributeCategory),
1079
+ $resourcePath
1080
+ );
1081
+ }
1082
+ // path params
1083
+ if ($attributeName !== null) {
1084
+ $resourcePath = str_replace(
1085
+ '{' . 'attributeName' . '}',
1086
+ ObjectSerializer::toPathValue($attributeName),
1087
+ $resourcePath
1088
+ );
1089
+ }
1090
+
1091
+ // body params
1092
+ $_tempBody = null;
1093
+ if (isset($updateAttribute)) {
1094
+ $_tempBody = $updateAttribute;
1095
+ }
1096
+
1097
+ if ($multipart) {
1098
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1099
+ ['application/json']
1100
+ );
1101
+ } else {
1102
+ $headers = $this->headerSelector->selectHeaders(
1103
+ ['application/json'],
1104
+ ['application/json']
1105
+ );
1106
+ }
1107
+
1108
+ // for model (json/xml)
1109
+ if (isset($_tempBody)) {
1110
+ // $_tempBody is the method argument, if present
1111
+ $httpBody = $_tempBody;
1112
+ // \stdClass has no __toString(), so we should encode it manually
1113
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1114
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1115
+ }
1116
+ } elseif (count($formParams) > 0) {
1117
+ if ($multipart) {
1118
+ $multipartContents = [];
1119
+ foreach ($formParams as $formParamName => $formParamValue) {
1120
+ $multipartContents[] = [
1121
+ 'name' => $formParamName,
1122
+ 'contents' => $formParamValue
1123
+ ];
1124
+ }
1125
+ // for HTTP post (form)
1126
+ $httpBody = new MultipartStream($multipartContents);
1127
+
1128
+ } elseif ($headers['Content-Type'] === 'application/json') {
1129
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1130
+
1131
+ } else {
1132
+ // for HTTP post (form)
1133
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1134
+ }
1135
+ }
1136
+
1137
+ // this endpoint requires API key authentication
1138
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1139
+ if ($apiKey !== null) {
1140
+ $headers['api-key'] = $apiKey;
1141
+ }
1142
+ // this endpoint requires API key authentication
1143
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1144
+ if ($apiKey !== null) {
1145
+ $headers['partner-key'] = $apiKey;
1146
+ }
1147
+
1148
+ $defaultHeaders = [];
1149
+ if ($this->config->getUserAgent()) {
1150
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1151
+ }
1152
+
1153
+ $headers = array_merge(
1154
+ $defaultHeaders,
1155
+ $headerParams,
1156
+ $headers
1157
+ );
1158
+
1159
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1160
+ return new Request(
1161
+ 'PUT',
1162
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1163
+ $headers,
1164
+ $httpBody
1165
+ );
1166
+ }
1167
+
1168
+ /**
1169
+ * Create http client option
1170
+ *
1171
+ * @throws \RuntimeException on file opening failure
1172
+ * @return array of http client options
1173
+ */
1174
+ protected function createHttpClientOption()
1175
+ {
1176
+ $options = [];
1177
+ if ($this->config->getDebug()) {
1178
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
1179
+ if (!$options[RequestOptions::DEBUG]) {
1180
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
1181
+ }
1182
+ }
1183
+
1184
+ return $options;
1185
+ }
1186
+ }
vendor/sendinblue/api-v3-sdk/lib/Api/ContactsApi.php ADDED
@@ -0,0 +1,7380 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ContactsApi
4
+ * PHP version 5
5
+ *
6
+ * @category Class
7
+ * @package SendinBlue\Client
8
+ * @author Swagger Codegen team
9
+ * @link https://github.com/swagger-api/swagger-codegen
10
+ */
11
+
12
+ /**
13
+ * SendinBlue API
14
+ *
15
+ * SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
16
+ *
17
+ * OpenAPI spec version: 3.0.0
18
+ * Contact: contact@sendinblue.com
19
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
20
+ * Swagger Codegen version: 2.3.1
21
+ */
22
+
23
+ /**
24
+ * NOTE: This class is auto generated by the swagger code generator program.
25
+ * https://github.com/swagger-api/swagger-codegen
26
+ * Do not edit the class manually.
27
+ */
28
+
29
+ namespace SendinBlue\Client\Api;
30
+
31
+ use GuzzleHttp\Client;
32
+ use GuzzleHttp\ClientInterface;
33
+ use GuzzleHttp\Exception\RequestException;
34
+ use GuzzleHttp\Psr7\MultipartStream;
35
+ use GuzzleHttp\Psr7\Request;
36
+ use GuzzleHttp\RequestOptions;
37
+ use SendinBlue\Client\ApiException;
38
+ use SendinBlue\Client\Configuration;
39
+ use SendinBlue\Client\HeaderSelector;
40
+ use SendinBlue\Client\ObjectSerializer;
41
+
42
+ /**
43
+ * ContactsApi Class Doc Comment
44
+ *
45
+ * @category Class
46
+ * @package SendinBlue\Client
47
+ * @author Swagger Codegen team
48
+ * @link https://github.com/swagger-api/swagger-codegen
49
+ */
50
+ class ContactsApi
51
+ {
52
+ /**
53
+ * @var ClientInterface
54
+ */
55
+ protected $client;
56
+
57
+ /**
58
+ * @var Configuration
59
+ */
60
+ protected $config;
61
+
62
+ /**
63
+ * @param ClientInterface $client
64
+ * @param Configuration $config
65
+ * @param HeaderSelector $selector
66
+ */
67
+ public function __construct(
68
+ ClientInterface $client = null,
69
+ Configuration $config = null,
70
+ HeaderSelector $selector = null
71
+ ) {
72
+ $this->client = $client ?: new Client();
73
+ $this->config = $config ?: new Configuration();
74
+ $this->headerSelector = $selector ?: new HeaderSelector();
75
+ }
76
+
77
+ /**
78
+ * @return Configuration
79
+ */
80
+ public function getConfig()
81
+ {
82
+ return $this->config;
83
+ }
84
+
85
+ /**
86
+ * Operation addContactToList
87
+ *
88
+ * Add existing contacts to a list
89
+ *
90
+ * @param int $listId Id of the list (required)
91
+ * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required)
92
+ *
93
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
94
+ * @throws \InvalidArgumentException
95
+ * @return \SendinBlue\Client\Model\PostContactInfo
96
+ */
97
+ public function addContactToList($listId, $contactEmails)
98
+ {
99
+ list($response) = $this->addContactToListWithHttpInfo($listId, $contactEmails);
100
+ return $response;
101
+ }
102
+
103
+ /**
104
+ * Operation addContactToListWithHttpInfo
105
+ *
106
+ * Add existing contacts to a list
107
+ *
108
+ * @param int $listId Id of the list (required)
109
+ * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required)
110
+ *
111
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
112
+ * @throws \InvalidArgumentException
113
+ * @return array of \SendinBlue\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings)
114
+ */
115
+ public function addContactToListWithHttpInfo($listId, $contactEmails)
116
+ {
117
+ $returnType = '\SendinBlue\Client\Model\PostContactInfo';
118
+ $request = $this->addContactToListRequest($listId, $contactEmails);
119
+
120
+ try {
121
+ $options = $this->createHttpClientOption();
122
+ try {
123
+ $response = $this->client->send($request, $options);
124
+ } catch (RequestException $e) {
125
+ throw new ApiException(
126
+ "[{$e->getCode()}] {$e->getMessage()}",
127
+ $e->getCode(),
128
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
129
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
130
+ );
131
+ }
132
+
133
+ $statusCode = $response->getStatusCode();
134
+
135
+ if ($statusCode < 200 || $statusCode > 299) {
136
+ throw new ApiException(
137
+ sprintf(
138
+ '[%d] Error connecting to the API (%s)',
139
+ $statusCode,
140
+ $request->getUri()
141
+ ),
142
+ $statusCode,
143
+ $response->getHeaders(),
144
+ $response->getBody()
145
+ );
146
+ }
147
+
148
+ $responseBody = $response->getBody();
149
+ if ($returnType === '\SplFileObject') {
150
+ $content = $responseBody; //stream goes to serializer
151
+ } else {
152
+ $content = $responseBody->getContents();
153
+ if ($returnType !== 'string') {
154
+ $content = json_decode($content);
155
+ }
156
+ }
157
+
158
+ return [
159
+ ObjectSerializer::deserialize($content, $returnType, []),
160
+ $response->getStatusCode(),
161
+ $response->getHeaders()
162
+ ];
163
+
164
+ } catch (ApiException $e) {
165
+ switch ($e->getCode()) {
166
+ case 201:
167
+ $data = ObjectSerializer::deserialize(
168
+ $e->getResponseBody(),
169
+ '\SendinBlue\Client\Model\PostContactInfo',
170
+ $e->getResponseHeaders()
171
+ );
172
+ $e->setResponseObject($data);
173
+ break;
174
+ case 400:
175
+ $data = ObjectSerializer::deserialize(
176
+ $e->getResponseBody(),
177
+ '\SendinBlue\Client\Model\ErrorModel',
178
+ $e->getResponseHeaders()
179
+ );
180
+ $e->setResponseObject($data);
181
+ break;
182
+ case 404:
183
+ $data = ObjectSerializer::deserialize(
184
+ $e->getResponseBody(),
185
+ '\SendinBlue\Client\Model\ErrorModel',
186
+ $e->getResponseHeaders()
187
+ );
188
+ $e->setResponseObject($data);
189
+ break;
190
+ }
191
+ throw $e;
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Operation addContactToListAsync
197
+ *
198
+ * Add existing contacts to a list
199
+ *
200
+ * @param int $listId Id of the list (required)
201
+ * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required)
202
+ *
203
+ * @throws \InvalidArgumentException
204
+ * @return \GuzzleHttp\Promise\PromiseInterface
205
+ */
206
+ public function addContactToListAsync($listId, $contactEmails)
207
+ {
208
+ return $this->addContactToListAsyncWithHttpInfo($listId, $contactEmails)
209
+ ->then(
210
+ function ($response) {
211
+ return $response[0];
212
+ }
213
+ );
214
+ }
215
+
216
+ /**
217
+ * Operation addContactToListAsyncWithHttpInfo
218
+ *
219
+ * Add existing contacts to a list
220
+ *
221
+ * @param int $listId Id of the list (required)
222
+ * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required)
223
+ *
224
+ * @throws \InvalidArgumentException
225
+ * @return \GuzzleHttp\Promise\PromiseInterface
226
+ */
227
+ public function addContactToListAsyncWithHttpInfo($listId, $contactEmails)
228
+ {
229
+ $returnType = '\SendinBlue\Client\Model\PostContactInfo';
230
+ $request = $this->addContactToListRequest($listId, $contactEmails);
231
+
232
+ return $this->client
233
+ ->sendAsync($request, $this->createHttpClientOption())
234
+ ->then(
235
+ function ($response) use ($returnType) {
236
+ $responseBody = $response->getBody();
237
+ if ($returnType === '\SplFileObject') {
238
+ $content = $responseBody; //stream goes to serializer
239
+ } else {
240
+ $content = $responseBody->getContents();
241
+ if ($returnType !== 'string') {
242
+ $content = json_decode($content);
243
+ }
244
+ }
245
+
246
+ return [
247
+ ObjectSerializer::deserialize($content, $returnType, []),
248
+ $response->getStatusCode(),
249
+ $response->getHeaders()
250
+ ];
251
+ },
252
+ function ($exception) {
253
+ $response = $exception->getResponse();
254
+ $statusCode = $response->getStatusCode();
255
+ throw new ApiException(
256
+ sprintf(
257
+ '[%d] Error connecting to the API (%s)',
258
+ $statusCode,
259
+ $exception->getRequest()->getUri()
260
+ ),
261
+ $statusCode,
262
+ $response->getHeaders(),
263
+ $response->getBody()
264
+ );
265
+ }
266
+ );
267
+ }
268
+
269
+ /**
270
+ * Create request for operation 'addContactToList'
271
+ *
272
+ * @param int $listId Id of the list (required)
273
+ * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required)
274
+ *
275
+ * @throws \InvalidArgumentException
276
+ * @return \GuzzleHttp\Psr7\Request
277
+ */
278
+ protected function addContactToListRequest($listId, $contactEmails)
279
+ {
280
+ // verify the required parameter 'listId' is set
281
+ if ($listId === null) {
282
+ throw new \InvalidArgumentException(
283
+ 'Missing the required parameter $listId when calling addContactToList'
284
+ );
285
+ }
286
+ // verify the required parameter 'contactEmails' is set
287
+ if ($contactEmails === null) {
288
+ throw new \InvalidArgumentException(
289
+ 'Missing the required parameter $contactEmails when calling addContactToList'
290
+ );
291
+ }
292
+
293
+ $resourcePath = '/contacts/lists/{listId}/contacts/add';
294
+ $formParams = [];
295
+ $queryParams = [];
296
+ $headerParams = [];
297
+ $httpBody = '';
298
+ $multipart = false;
299
+
300
+
301
+ // path params
302
+ if ($listId !== null) {
303
+ $resourcePath = str_replace(
304
+ '{' . 'listId' . '}',
305
+ ObjectSerializer::toPathValue($listId),
306
+ $resourcePath
307
+ );
308
+ }
309
+
310
+ // body params
311
+ $_tempBody = null;
312
+ if (isset($contactEmails)) {
313
+ $_tempBody = $contactEmails;
314
+ }
315
+
316
+ if ($multipart) {
317
+ $headers = $this->headerSelector->selectHeadersForMultipart(
318
+ ['application/json']
319
+ );
320
+ } else {
321
+ $headers = $this->headerSelector->selectHeaders(
322
+ ['application/json'],
323
+ ['application/json']
324
+ );
325
+ }
326
+
327
+ // for model (json/xml)
328
+ if (isset($_tempBody)) {
329
+ // $_tempBody is the method argument, if present
330
+ $httpBody = $_tempBody;
331
+ // \stdClass has no __toString(), so we should encode it manually
332
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
333
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
334
+ }
335
+ } elseif (count($formParams) > 0) {
336
+ if ($multipart) {
337
+ $multipartContents = [];
338
+ foreach ($formParams as $formParamName => $formParamValue) {
339
+ $multipartContents[] = [
340
+ 'name' => $formParamName,
341
+ 'contents' => $formParamValue
342
+ ];
343
+ }
344
+ // for HTTP post (form)
345
+ $httpBody = new MultipartStream($multipartContents);
346
+
347
+ } elseif ($headers['Content-Type'] === 'application/json') {
348
+ $httpBody = \GuzzleHttp\json_encode($formParams);
349
+
350
+ } else {
351
+ // for HTTP post (form)
352
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
353
+ }
354
+ }
355
+
356
+ // this endpoint requires API key authentication
357
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
358
+ if ($apiKey !== null) {
359
+ $headers['api-key'] = $apiKey;
360
+ }
361
+ // this endpoint requires API key authentication
362
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
363
+ if ($apiKey !== null) {
364
+ $headers['partner-key'] = $apiKey;
365
+ }
366
+
367
+ $defaultHeaders = [];
368
+ if ($this->config->getUserAgent()) {
369
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
370
+ }
371
+
372
+ $headers = array_merge(
373
+ $defaultHeaders,
374
+ $headerParams,
375
+ $headers
376
+ );
377
+
378
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
379
+ return new Request(
380
+ 'POST',
381
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
382
+ $headers,
383
+ $httpBody
384
+ );
385
+ }
386
+
387
+ /**
388
+ * Operation createAttribute
389
+ *
390
+ * Creates contact attribute
391
+ *
392
+ * @param string $attributeCategory Category of the attribute (required)
393
+ * @param string $attributeName Name of the attribute (required)
394
+ * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required)
395
+ *
396
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
397
+ * @throws \InvalidArgumentException
398
+ * @return void
399
+ */
400
+ public function createAttribute($attributeCategory, $attributeName, $createAttribute)
401
+ {
402
+ $this->createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute);
403
+ }
404
+
405
+ /**
406
+ * Operation createAttributeWithHttpInfo
407
+ *
408
+ * Creates contact attribute
409
+ *
410
+ * @param string $attributeCategory Category of the attribute (required)
411
+ * @param string $attributeName Name of the attribute (required)
412
+ * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required)
413
+ *
414
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
415
+ * @throws \InvalidArgumentException
416
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
417
+ */
418
+ public function createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute)
419
+ {
420
+ $returnType = '';
421
+ $request = $this->createAttributeRequest($attributeCategory, $attributeName, $createAttribute);
422
+
423
+ try {
424
+ $options = $this->createHttpClientOption();
425
+ try {
426
+ $response = $this->client->send($request, $options);
427
+ } catch (RequestException $e) {
428
+ throw new ApiException(
429
+ "[{$e->getCode()}] {$e->getMessage()}",
430
+ $e->getCode(),
431
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
432
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
433
+ );
434
+ }
435
+
436
+ $statusCode = $response->getStatusCode();
437
+
438
+ if ($statusCode < 200 || $statusCode > 299) {
439
+ throw new ApiException(
440
+ sprintf(
441
+ '[%d] Error connecting to the API (%s)',
442
+ $statusCode,
443
+ $request->getUri()
444
+ ),
445
+ $statusCode,
446
+ $response->getHeaders(),
447
+ $response->getBody()
448
+ );
449
+ }
450
+
451
+ return [null, $statusCode, $response->getHeaders()];
452
+
453
+ } catch (ApiException $e) {
454
+ switch ($e->getCode()) {
455
+ case 400:
456
+ $data = ObjectSerializer::deserialize(
457
+ $e->getResponseBody(),
458
+ '\SendinBlue\Client\Model\ErrorModel',
459
+ $e->getResponseHeaders()
460
+ );
461
+ $e->setResponseObject($data);
462
+ break;
463
+ }
464
+ throw $e;
465
+ }
466
+ }
467
+
468
+ /**
469
+ * Operation createAttributeAsync
470
+ *
471
+ * Creates contact attribute
472
+ *
473
+ * @param string $attributeCategory Category of the attribute (required)
474
+ * @param string $attributeName Name of the attribute (required)
475
+ * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required)
476
+ *
477
+ * @throws \InvalidArgumentException
478
+ * @return \GuzzleHttp\Promise\PromiseInterface
479
+ */
480
+ public function createAttributeAsync($attributeCategory, $attributeName, $createAttribute)
481
+ {
482
+ return $this->createAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $createAttribute)
483
+ ->then(
484
+ function ($response) {
485
+ return $response[0];
486
+ }
487
+ );
488
+ }
489
+
490
+ /**
491
+ * Operation createAttributeAsyncWithHttpInfo
492
+ *
493
+ * Creates contact attribute
494
+ *
495
+ * @param string $attributeCategory Category of the attribute (required)
496
+ * @param string $attributeName Name of the attribute (required)
497
+ * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required)
498
+ *
499
+ * @throws \InvalidArgumentException
500
+ * @return \GuzzleHttp\Promise\PromiseInterface
501
+ */
502
+ public function createAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $createAttribute)
503
+ {
504
+ $returnType = '';
505
+ $request = $this->createAttributeRequest($attributeCategory, $attributeName, $createAttribute);
506
+
507
+ return $this->client
508
+ ->sendAsync($request, $this->createHttpClientOption())
509
+ ->then(
510
+ function ($response) use ($returnType) {
511
+ return [null, $response->getStatusCode(), $response->getHeaders()];
512
+ },
513
+ function ($exception) {
514
+ $response = $exception->getResponse();
515
+ $statusCode = $response->getStatusCode();
516
+ throw new ApiException(
517
+ sprintf(
518
+ '[%d] Error connecting to the API (%s)',
519
+ $statusCode,
520
+ $exception->getRequest()->getUri()
521
+ ),
522
+ $statusCode,
523
+ $response->getHeaders(),
524
+ $response->getBody()
525
+ );
526
+ }
527
+ );
528
+ }
529
+
530
+ /**
531
+ * Create request for operation 'createAttribute'
532
+ *
533
+ * @param string $attributeCategory Category of the attribute (required)
534
+ * @param string $attributeName Name of the attribute (required)
535
+ * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required)
536
+ *
537
+ * @throws \InvalidArgumentException
538
+ * @return \GuzzleHttp\Psr7\Request
539
+ */
540
+ protected function createAttributeRequest($attributeCategory, $attributeName, $createAttribute)
541
+ {
542
+ // verify the required parameter 'attributeCategory' is set
543
+ if ($attributeCategory === null) {
544
+ throw new \InvalidArgumentException(
545
+ 'Missing the required parameter $attributeCategory when calling createAttribute'
546
+ );
547
+ }
548
+ // verify the required parameter 'attributeName' is set
549
+ if ($attributeName === null) {
550
+ throw new \InvalidArgumentException(
551
+ 'Missing the required parameter $attributeName when calling createAttribute'
552
+ );
553
+ }
554
+ // verify the required parameter 'createAttribute' is set
555
+ if ($createAttribute === null) {
556
+ throw new \InvalidArgumentException(
557
+ 'Missing the required parameter $createAttribute when calling createAttribute'
558
+ );
559
+ }
560
+
561
+ $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}';
562
+ $formParams = [];
563
+ $queryParams = [];
564
+ $headerParams = [];
565
+ $httpBody = '';
566
+ $multipart = false;
567
+
568
+
569
+ // path params
570
+ if ($attributeCategory !== null) {
571
+ $resourcePath = str_replace(
572
+ '{' . 'attributeCategory' . '}',
573
+ ObjectSerializer::toPathValue($attributeCategory),
574
+ $resourcePath
575
+ );
576
+ }
577
+ // path params
578
+ if ($attributeName !== null) {
579
+ $resourcePath = str_replace(
580
+ '{' . 'attributeName' . '}',
581
+ ObjectSerializer::toPathValue($attributeName),
582
+ $resourcePath
583
+ );
584
+ }
585
+
586
+ // body params
587
+ $_tempBody = null;
588
+ if (isset($createAttribute)) {
589
+ $_tempBody = $createAttribute;
590
+ }
591
+
592
+ if ($multipart) {
593
+ $headers = $this->headerSelector->selectHeadersForMultipart(
594
+ ['application/json']
595
+ );
596
+ } else {
597
+ $headers = $this->headerSelector->selectHeaders(
598
+ ['application/json'],
599
+ ['application/json']
600
+ );
601
+ }
602
+
603
+ // for model (json/xml)
604
+ if (isset($_tempBody)) {
605
+ // $_tempBody is the method argument, if present
606
+ $httpBody = $_tempBody;
607
+ // \stdClass has no __toString(), so we should encode it manually
608
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
609
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
610
+ }
611
+ } elseif (count($formParams) > 0) {
612
+ if ($multipart) {
613
+ $multipartContents = [];
614
+ foreach ($formParams as $formParamName => $formParamValue) {
615
+ $multipartContents[] = [
616
+ 'name' => $formParamName,
617
+ 'contents' => $formParamValue
618
+ ];
619
+ }
620
+ // for HTTP post (form)
621
+ $httpBody = new MultipartStream($multipartContents);
622
+
623
+ } elseif ($headers['Content-Type'] === 'application/json') {
624
+ $httpBody = \GuzzleHttp\json_encode($formParams);
625
+
626
+ } else {
627
+ // for HTTP post (form)
628
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
629
+ }
630
+ }
631
+
632
+ // this endpoint requires API key authentication
633
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
634
+ if ($apiKey !== null) {
635
+ $headers['api-key'] = $apiKey;
636
+ }
637
+ // this endpoint requires API key authentication
638
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
639
+ if ($apiKey !== null) {
640
+ $headers['partner-key'] = $apiKey;
641
+ }
642
+
643
+ $defaultHeaders = [];
644
+ if ($this->config->getUserAgent()) {
645
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
646
+ }
647
+
648
+ $headers = array_merge(
649
+ $defaultHeaders,
650
+ $headerParams,
651
+ $headers
652
+ );
653
+
654
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
655
+ return new Request(
656
+ 'POST',
657
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
658
+ $headers,
659
+ $httpBody
660
+ );
661
+ }
662
+
663
+ /**
664
+ * Operation createContact
665
+ *
666
+ * Create a contact
667
+ *
668
+ * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required)
669
+ *
670
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
671
+ * @throws \InvalidArgumentException
672
+ * @return \SendinBlue\Client\Model\CreateUpdateContactModel
673
+ */
674
+ public function createContact($createContact)
675
+ {
676
+ list($response) = $this->createContactWithHttpInfo($createContact);
677
+ return $response;
678
+ }
679
+
680
+ /**
681
+ * Operation createContactWithHttpInfo
682
+ *
683
+ * Create a contact
684
+ *
685
+ * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required)
686
+ *
687
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
688
+ * @throws \InvalidArgumentException
689
+ * @return array of \SendinBlue\Client\Model\CreateUpdateContactModel, HTTP status code, HTTP response headers (array of strings)
690
+ */
691
+ public function createContactWithHttpInfo($createContact)
692
+ {
693
+ $returnType = '\SendinBlue\Client\Model\CreateUpdateContactModel';
694
+ $request = $this->createContactRequest($createContact);
695
+
696
+ try {
697
+ $options = $this->createHttpClientOption();
698
+ try {
699
+ $response = $this->client->send($request, $options);
700
+ } catch (RequestException $e) {
701
+ throw new ApiException(
702
+ "[{$e->getCode()}] {$e->getMessage()}",
703
+ $e->getCode(),
704
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
705
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
706
+ );
707
+ }
708
+
709
+ $statusCode = $response->getStatusCode();
710
+
711
+ if ($statusCode < 200 || $statusCode > 299) {
712
+ throw new ApiException(
713
+ sprintf(
714
+ '[%d] Error connecting to the API (%s)',
715
+ $statusCode,
716
+ $request->getUri()
717
+ ),
718
+ $statusCode,
719
+ $response->getHeaders(),
720
+ $response->getBody()
721
+ );
722
+ }
723
+
724
+ $responseBody = $response->getBody();
725
+ if ($returnType === '\SplFileObject') {
726
+ $content = $responseBody; //stream goes to serializer
727
+ } else {
728
+ $content = $responseBody->getContents();
729
+ if ($returnType !== 'string') {
730
+ $content = json_decode($content);
731
+ }
732
+ }
733
+
734
+ return [
735
+ ObjectSerializer::deserialize($content, $returnType, []),
736
+ $response->getStatusCode(),
737
+ $response->getHeaders()
738
+ ];
739
+
740
+ } catch (ApiException $e) {
741
+ switch ($e->getCode()) {
742
+ case 201:
743
+ $data = ObjectSerializer::deserialize(
744
+ $e->getResponseBody(),
745
+ '\SendinBlue\Client\Model\CreateUpdateContactModel',
746
+ $e->getResponseHeaders()
747
+ );
748
+ $e->setResponseObject($data);
749
+ break;
750
+ case 204:
751
+ $data = ObjectSerializer::deserialize(
752
+ $e->getResponseBody(),
753
+ '\SendinBlue\Client\Model\CreateUpdateContactModel',
754
+ $e->getResponseHeaders()
755
+ );
756
+ $e->setResponseObject($data);
757
+ break;
758
+ case 400:
759
+ $data = ObjectSerializer::deserialize(
760
+ $e->getResponseBody(),
761
+ '\SendinBlue\Client\Model\ErrorModel',
762
+ $e->getResponseHeaders()
763
+ );
764
+ $e->setResponseObject($data);
765
+ break;
766
+ }
767
+ throw $e;
768
+ }
769
+ }
770
+
771
+ /**
772
+ * Operation createContactAsync
773
+ *
774
+ * Create a contact
775
+ *
776
+ * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required)
777
+ *
778
+ * @throws \InvalidArgumentException
779
+ * @return \GuzzleHttp\Promise\PromiseInterface
780
+ */
781
+ public function createContactAsync($createContact)
782
+ {
783
+ return $this->createContactAsyncWithHttpInfo($createContact)
784
+ ->then(
785
+ function ($response) {
786
+ return $response[0];
787
+ }
788
+ );
789
+ }
790
+
791
+ /**
792
+ * Operation createContactAsyncWithHttpInfo
793
+ *
794
+ * Create a contact
795
+ *
796
+ * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required)
797
+ *
798
+ * @throws \InvalidArgumentException
799
+ * @return \GuzzleHttp\Promise\PromiseInterface
800
+ */
801
+ public function createContactAsyncWithHttpInfo($createContact)
802
+ {
803
+ $returnType = '\SendinBlue\Client\Model\CreateUpdateContactModel';
804
+ $request = $this->createContactRequest($createContact);
805
+
806
+ return $this->client
807
+ ->sendAsync($request, $this->createHttpClientOption())
808
+ ->then(
809
+ function ($response) use ($returnType) {
810
+ $responseBody = $response->getBody();
811
+ if ($returnType === '\SplFileObject') {
812
+ $content = $responseBody; //stream goes to serializer
813
+ } else {
814
+ $content = $responseBody->getContents();
815
+ if ($returnType !== 'string') {
816
+ $content = json_decode($content);
817
+ }
818
+ }
819
+
820
+ return [
821
+ ObjectSerializer::deserialize($content, $returnType, []),
822
+ $response->getStatusCode(),
823
+ $response->getHeaders()
824
+ ];
825
+ },
826
+ function ($exception) {
827
+ $response = $exception->getResponse();
828
+ $statusCode = $response->getStatusCode();
829
+ throw new ApiException(
830
+ sprintf(
831
+ '[%d] Error connecting to the API (%s)',
832
+ $statusCode,
833
+ $exception->getRequest()->getUri()
834
+ ),
835
+ $statusCode,
836
+ $response->getHeaders(),
837
+ $response->getBody()
838
+ );
839
+ }
840
+ );
841
+ }
842
+
843
+ /**
844
+ * Create request for operation 'createContact'
845
+ *
846
+ * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required)
847
+ *
848
+ * @throws \InvalidArgumentException
849
+ * @return \GuzzleHttp\Psr7\Request
850
+ */
851
+ protected function createContactRequest($createContact)
852
+ {
853
+ // verify the required parameter 'createContact' is set
854
+ if ($createContact === null) {
855
+ throw new \InvalidArgumentException(
856
+ 'Missing the required parameter $createContact when calling createContact'
857
+ );
858
+ }
859
+
860
+ $resourcePath = '/contacts';
861
+ $formParams = [];
862
+ $queryParams = [];
863
+ $headerParams = [];
864
+ $httpBody = '';
865
+ $multipart = false;
866
+
867
+
868
+
869
+ // body params
870
+ $_tempBody = null;
871
+ if (isset($createContact)) {
872
+ $_tempBody = $createContact;
873
+ }
874
+
875
+ if ($multipart) {
876
+ $headers = $this->headerSelector->selectHeadersForMultipart(
877
+ ['application/json']
878
+ );
879
+ } else {
880
+ $headers = $this->headerSelector->selectHeaders(
881
+ ['application/json'],
882
+ ['application/json']
883
+ );
884
+ }
885
+
886
+ // for model (json/xml)
887
+ if (isset($_tempBody)) {
888
+ // $_tempBody is the method argument, if present
889
+ $httpBody = $_tempBody;
890
+ // \stdClass has no __toString(), so we should encode it manually
891
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
892
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
893
+ }
894
+ } elseif (count($formParams) > 0) {
895
+ if ($multipart) {
896
+ $multipartContents = [];
897
+ foreach ($formParams as $formParamName => $formParamValue) {
898
+ $multipartContents[] = [
899
+ 'name' => $formParamName,
900
+ 'contents' => $formParamValue
901
+ ];
902
+ }
903
+ // for HTTP post (form)
904
+ $httpBody = new MultipartStream($multipartContents);
905
+
906
+ } elseif ($headers['Content-Type'] === 'application/json') {
907
+ $httpBody = \GuzzleHttp\json_encode($formParams);
908
+
909
+ } else {
910
+ // for HTTP post (form)
911
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
912
+ }
913
+ }
914
+
915
+ // this endpoint requires API key authentication
916
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
917
+ if ($apiKey !== null) {
918
+ $headers['api-key'] = $apiKey;
919
+ }
920
+ // this endpoint requires API key authentication
921
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
922
+ if ($apiKey !== null) {
923
+ $headers['partner-key'] = $apiKey;
924
+ }
925
+
926
+ $defaultHeaders = [];
927
+ if ($this->config->getUserAgent()) {
928
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
929
+ }
930
+
931
+ $headers = array_merge(
932
+ $defaultHeaders,
933
+ $headerParams,
934
+ $headers
935
+ );
936
+
937
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
938
+ return new Request(
939
+ 'POST',
940
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
941
+ $headers,
942
+ $httpBody
943
+ );
944
+ }
945
+
946
+ /**
947
+ * Operation createFolder
948
+ *
949
+ * Create a folder
950
+ *
951
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required)
952
+ *
953
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
954
+ * @throws \InvalidArgumentException
955
+ * @return \SendinBlue\Client\Model\CreateModel
956
+ */
957
+ public function createFolder($createFolder)
958
+ {
959
+ list($response) = $this->createFolderWithHttpInfo($createFolder);
960
+ return $response;
961
+ }
962
+
963
+ /**
964
+ * Operation createFolderWithHttpInfo
965
+ *
966
+ * Create a folder
967
+ *
968
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required)
969
+ *
970
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
971
+ * @throws \InvalidArgumentException
972
+ * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings)
973
+ */
974
+ public function createFolderWithHttpInfo($createFolder)
975
+ {
976
+ $returnType = '\SendinBlue\Client\Model\CreateModel';
977
+ $request = $this->createFolderRequest($createFolder);
978
+
979
+ try {
980
+ $options = $this->createHttpClientOption();
981
+ try {
982
+ $response = $this->client->send($request, $options);
983
+ } catch (RequestException $e) {
984
+ throw new ApiException(
985
+ "[{$e->getCode()}] {$e->getMessage()}",
986
+ $e->getCode(),
987
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
988
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
989
+ );
990
+ }
991
+
992
+ $statusCode = $response->getStatusCode();
993
+
994
+ if ($statusCode < 200 || $statusCode > 299) {
995
+ throw new ApiException(
996
+ sprintf(
997
+ '[%d] Error connecting to the API (%s)',
998
+ $statusCode,
999
+ $request->getUri()
1000
+ ),
1001
+ $statusCode,
1002
+ $response->getHeaders(),
1003
+ $response->getBody()
1004
+ );
1005
+ }
1006
+
1007
+ $responseBody = $response->getBody();
1008
+ if ($returnType === '\SplFileObject') {
1009
+ $content = $responseBody; //stream goes to serializer
1010
+ } else {
1011
+ $content = $responseBody->getContents();
1012
+ if ($returnType !== 'string') {
1013
+ $content = json_decode($content);
1014
+ }
1015
+ }
1016
+
1017
+ return [
1018
+ ObjectSerializer::deserialize($content, $returnType, []),
1019
+ $response->getStatusCode(),
1020
+ $response->getHeaders()
1021
+ ];
1022
+
1023
+ } catch (ApiException $e) {
1024
+ switch ($e->getCode()) {
1025
+ case 201:
1026
+ $data = ObjectSerializer::deserialize(
1027
+ $e->getResponseBody(),
1028
+ '\SendinBlue\Client\Model\CreateModel',
1029
+ $e->getResponseHeaders()
1030
+ );
1031
+ $e->setResponseObject($data);
1032
+ break;
1033
+ case 400:
1034
+ $data = ObjectSerializer::deserialize(
1035
+ $e->getResponseBody(),
1036
+ '\SendinBlue\Client\Model\ErrorModel',
1037
+ $e->getResponseHeaders()
1038
+ );
1039
+ $e->setResponseObject($data);
1040
+ break;
1041
+ }
1042
+ throw $e;
1043
+ }
1044
+ }
1045
+
1046
+ /**
1047
+ * Operation createFolderAsync
1048
+ *
1049
+ * Create a folder
1050
+ *
1051
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required)
1052
+ *
1053
+ * @throws \InvalidArgumentException
1054
+ * @return \GuzzleHttp\Promise\PromiseInterface
1055
+ */
1056
+ public function createFolderAsync($createFolder)
1057
+ {
1058
+ return $this->createFolderAsyncWithHttpInfo($createFolder)
1059
+ ->then(
1060
+ function ($response) {
1061
+ return $response[0];
1062
+ }
1063
+ );
1064
+ }
1065
+
1066
+ /**
1067
+ * Operation createFolderAsyncWithHttpInfo
1068
+ *
1069
+ * Create a folder
1070
+ *
1071
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required)
1072
+ *
1073
+ * @throws \InvalidArgumentException
1074
+ * @return \GuzzleHttp\Promise\PromiseInterface
1075
+ */
1076
+ public function createFolderAsyncWithHttpInfo($createFolder)
1077
+ {
1078
+ $returnType = '\SendinBlue\Client\Model\CreateModel';
1079
+ $request = $this->createFolderRequest($createFolder);
1080
+
1081
+ return $this->client
1082
+ ->sendAsync($request, $this->createHttpClientOption())
1083
+ ->then(
1084
+ function ($response) use ($returnType) {
1085
+ $responseBody = $response->getBody();
1086
+ if ($returnType === '\SplFileObject') {
1087
+ $content = $responseBody; //stream goes to serializer
1088
+ } else {
1089
+ $content = $responseBody->getContents();
1090
+ if ($returnType !== 'string') {
1091
+ $content = json_decode($content);
1092
+ }
1093
+ }
1094
+
1095
+ return [
1096
+ ObjectSerializer::deserialize($content, $returnType, []),
1097
+ $response->getStatusCode(),
1098
+ $response->getHeaders()
1099
+ ];
1100
+ },
1101
+ function ($exception) {
1102
+ $response = $exception->getResponse();
1103
+ $statusCode = $response->getStatusCode();
1104
+ throw new ApiException(
1105
+ sprintf(
1106
+ '[%d] Error connecting to the API (%s)',
1107
+ $statusCode,
1108
+ $exception->getRequest()->getUri()
1109
+ ),
1110
+ $statusCode,
1111
+ $response->getHeaders(),
1112
+ $response->getBody()
1113
+ );
1114
+ }
1115
+ );
1116
+ }
1117
+
1118
+ /**
1119
+ * Create request for operation 'createFolder'
1120
+ *
1121
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required)
1122
+ *
1123
+ * @throws \InvalidArgumentException
1124
+ * @return \GuzzleHttp\Psr7\Request
1125
+ */
1126
+ protected function createFolderRequest($createFolder)
1127
+ {
1128
+ // verify the required parameter 'createFolder' is set
1129
+ if ($createFolder === null) {
1130
+ throw new \InvalidArgumentException(
1131
+ 'Missing the required parameter $createFolder when calling createFolder'
1132
+ );
1133
+ }
1134
+
1135
+ $resourcePath = '/contacts/folders';
1136
+ $formParams = [];
1137
+ $queryParams = [];
1138
+ $headerParams = [];
1139
+ $httpBody = '';
1140
+ $multipart = false;
1141
+
1142
+
1143
+
1144
+ // body params
1145
+ $_tempBody = null;
1146
+ if (isset($createFolder)) {
1147
+ $_tempBody = $createFolder;
1148
+ }
1149
+
1150
+ if ($multipart) {
1151
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1152
+ ['application/json']
1153
+ );
1154
+ } else {
1155
+ $headers = $this->headerSelector->selectHeaders(
1156
+ ['application/json'],
1157
+ ['application/json']
1158
+ );
1159
+ }
1160
+
1161
+ // for model (json/xml)
1162
+ if (isset($_tempBody)) {
1163
+ // $_tempBody is the method argument, if present
1164
+ $httpBody = $_tempBody;
1165
+ // \stdClass has no __toString(), so we should encode it manually
1166
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1167
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1168
+ }
1169
+ } elseif (count($formParams) > 0) {
1170
+ if ($multipart) {
1171
+ $multipartContents = [];
1172
+ foreach ($formParams as $formParamName => $formParamValue) {
1173
+ $multipartContents[] = [
1174
+ 'name' => $formParamName,
1175
+ 'contents' => $formParamValue
1176
+ ];
1177
+ }
1178
+ // for HTTP post (form)
1179
+ $httpBody = new MultipartStream($multipartContents);
1180
+
1181
+ } elseif ($headers['Content-Type'] === 'application/json') {
1182
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1183
+
1184
+ } else {
1185
+ // for HTTP post (form)
1186
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1187
+ }
1188
+ }
1189
+
1190
+ // this endpoint requires API key authentication
1191
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1192
+ if ($apiKey !== null) {
1193
+ $headers['api-key'] = $apiKey;
1194
+ }
1195
+ // this endpoint requires API key authentication
1196
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1197
+ if ($apiKey !== null) {
1198
+ $headers['partner-key'] = $apiKey;
1199
+ }
1200
+
1201
+ $defaultHeaders = [];
1202
+ if ($this->config->getUserAgent()) {
1203
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1204
+ }
1205
+
1206
+ $headers = array_merge(
1207
+ $defaultHeaders,
1208
+ $headerParams,
1209
+ $headers
1210
+ );
1211
+
1212
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1213
+ return new Request(
1214
+ 'POST',
1215
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1216
+ $headers,
1217
+ $httpBody
1218
+ );
1219
+ }
1220
+
1221
+ /**
1222
+ * Operation createList
1223
+ *
1224
+ * Create a list
1225
+ *
1226
+ * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required)
1227
+ *
1228
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1229
+ * @throws \InvalidArgumentException
1230
+ * @return \SendinBlue\Client\Model\CreateModel
1231
+ */
1232
+ public function createList($createList)
1233
+ {
1234
+ list($response) = $this->createListWithHttpInfo($createList);
1235
+ return $response;
1236
+ }
1237
+
1238
+ /**
1239
+ * Operation createListWithHttpInfo
1240
+ *
1241
+ * Create a list
1242
+ *
1243
+ * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required)
1244
+ *
1245
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1246
+ * @throws \InvalidArgumentException
1247
+ * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings)
1248
+ */
1249
+ public function createListWithHttpInfo($createList)
1250
+ {
1251
+ $returnType = '\SendinBlue\Client\Model\CreateModel';
1252
+ $request = $this->createListRequest($createList);
1253
+
1254
+ try {
1255
+ $options = $this->createHttpClientOption();
1256
+ try {
1257
+ $response = $this->client->send($request, $options);
1258
+ } catch (RequestException $e) {
1259
+ throw new ApiException(
1260
+ "[{$e->getCode()}] {$e->getMessage()}",
1261
+ $e->getCode(),
1262
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1263
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1264
+ );
1265
+ }
1266
+
1267
+ $statusCode = $response->getStatusCode();
1268
+
1269
+ if ($statusCode < 200 || $statusCode > 299) {
1270
+ throw new ApiException(
1271
+ sprintf(
1272
+ '[%d] Error connecting to the API (%s)',
1273
+ $statusCode,
1274
+ $request->getUri()
1275
+ ),
1276
+ $statusCode,
1277
+ $response->getHeaders(),
1278
+ $response->getBody()
1279
+ );
1280
+ }
1281
+
1282
+ $responseBody = $response->getBody();
1283
+ if ($returnType === '\SplFileObject') {
1284
+ $content = $responseBody; //stream goes to serializer
1285
+ } else {
1286
+ $content = $responseBody->getContents();
1287
+ if ($returnType !== 'string') {
1288
+ $content = json_decode($content);
1289
+ }
1290
+ }
1291
+
1292
+ return [
1293
+ ObjectSerializer::deserialize($content, $returnType, []),
1294
+ $response->getStatusCode(),
1295
+ $response->getHeaders()
1296
+ ];
1297
+
1298
+ } catch (ApiException $e) {
1299
+ switch ($e->getCode()) {
1300
+ case 201:
1301
+ $data = ObjectSerializer::deserialize(
1302
+ $e->getResponseBody(),
1303
+ '\SendinBlue\Client\Model\CreateModel',
1304
+ $e->getResponseHeaders()
1305
+ );
1306
+ $e->setResponseObject($data);
1307
+ break;
1308
+ case 400:
1309
+ $data = ObjectSerializer::deserialize(
1310
+ $e->getResponseBody(),
1311
+ '\SendinBlue\Client\Model\ErrorModel',
1312
+ $e->getResponseHeaders()
1313
+ );
1314
+ $e->setResponseObject($data);
1315
+ break;
1316
+ }
1317
+ throw $e;
1318
+ }
1319
+ }
1320
+
1321
+ /**
1322
+ * Operation createListAsync
1323
+ *
1324
+ * Create a list
1325
+ *
1326
+ * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required)
1327
+ *
1328
+ * @throws \InvalidArgumentException
1329
+ * @return \GuzzleHttp\Promise\PromiseInterface
1330
+ */
1331
+ public function createListAsync($createList)
1332
+ {
1333
+ return $this->createListAsyncWithHttpInfo($createList)
1334
+ ->then(
1335
+ function ($response) {
1336
+ return $response[0];
1337
+ }
1338
+ );
1339
+ }
1340
+
1341
+ /**
1342
+ * Operation createListAsyncWithHttpInfo
1343
+ *
1344
+ * Create a list
1345
+ *
1346
+ * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required)
1347
+ *
1348
+ * @throws \InvalidArgumentException
1349
+ * @return \GuzzleHttp\Promise\PromiseInterface
1350
+ */
1351
+ public function createListAsyncWithHttpInfo($createList)
1352
+ {
1353
+ $returnType = '\SendinBlue\Client\Model\CreateModel';
1354
+ $request = $this->createListRequest($createList);
1355
+
1356
+ return $this->client
1357
+ ->sendAsync($request, $this->createHttpClientOption())
1358
+ ->then(
1359
+ function ($response) use ($returnType) {
1360
+ $responseBody = $response->getBody();
1361
+ if ($returnType === '\SplFileObject') {
1362
+ $content = $responseBody; //stream goes to serializer
1363
+ } else {
1364
+ $content = $responseBody->getContents();
1365
+ if ($returnType !== 'string') {
1366
+ $content = json_decode($content);
1367
+ }
1368
+ }
1369
+
1370
+ return [
1371
+ ObjectSerializer::deserialize($content, $returnType, []),
1372
+ $response->getStatusCode(),
1373
+ $response->getHeaders()
1374
+ ];
1375
+ },
1376
+ function ($exception) {
1377
+ $response = $exception->getResponse();
1378
+ $statusCode = $response->getStatusCode();
1379
+ throw new ApiException(
1380
+ sprintf(
1381
+ '[%d] Error connecting to the API (%s)',
1382
+ $statusCode,
1383
+ $exception->getRequest()->getUri()
1384
+ ),
1385
+ $statusCode,
1386
+ $response->getHeaders(),
1387
+ $response->getBody()
1388
+ );
1389
+ }
1390
+ );
1391
+ }
1392
+
1393
+ /**
1394
+ * Create request for operation 'createList'
1395
+ *
1396
+ * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required)
1397
+ *
1398
+ * @throws \InvalidArgumentException
1399
+ * @return \GuzzleHttp\Psr7\Request
1400
+ */
1401
+ protected function createListRequest($createList)
1402
+ {
1403
+ // verify the required parameter 'createList' is set
1404
+ if ($createList === null) {
1405
+ throw new \InvalidArgumentException(
1406
+ 'Missing the required parameter $createList when calling createList'
1407
+ );
1408
+ }
1409
+
1410
+ $resourcePath = '/contacts/lists';
1411
+ $formParams = [];
1412
+ $queryParams = [];
1413
+ $headerParams = [];
1414
+ $httpBody = '';
1415
+ $multipart = false;
1416
+
1417
+
1418
+
1419
+ // body params
1420
+ $_tempBody = null;
1421
+ if (isset($createList)) {
1422
+ $_tempBody = $createList;
1423
+ }
1424
+
1425
+ if ($multipart) {
1426
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1427
+ ['application/json']
1428
+ );
1429
+ } else {
1430
+ $headers = $this->headerSelector->selectHeaders(
1431
+ ['application/json'],
1432
+ ['application/json']
1433
+ );
1434
+ }
1435
+
1436
+ // for model (json/xml)
1437
+ if (isset($_tempBody)) {
1438
+ // $_tempBody is the method argument, if present
1439
+ $httpBody = $_tempBody;
1440
+ // \stdClass has no __toString(), so we should encode it manually
1441
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1442
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1443
+ }
1444
+ } elseif (count($formParams) > 0) {
1445
+ if ($multipart) {
1446
+ $multipartContents = [];
1447
+ foreach ($formParams as $formParamName => $formParamValue) {
1448
+ $multipartContents[] = [
1449
+ 'name' => $formParamName,
1450
+ 'contents' => $formParamValue
1451
+ ];
1452
+ }
1453
+ // for HTTP post (form)
1454
+ $httpBody = new MultipartStream($multipartContents);
1455
+
1456
+ } elseif ($headers['Content-Type'] === 'application/json') {
1457
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1458
+
1459
+ } else {
1460
+ // for HTTP post (form)
1461
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1462
+ }
1463
+ }
1464
+
1465
+ // this endpoint requires API key authentication
1466
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1467
+ if ($apiKey !== null) {
1468
+ $headers['api-key'] = $apiKey;
1469
+ }
1470
+ // this endpoint requires API key authentication
1471
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1472
+ if ($apiKey !== null) {
1473
+ $headers['partner-key'] = $apiKey;
1474
+ }
1475
+
1476
+ $defaultHeaders = [];
1477
+ if ($this->config->getUserAgent()) {
1478
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1479
+ }
1480
+
1481
+ $headers = array_merge(
1482
+ $defaultHeaders,
1483
+ $headerParams,
1484
+ $headers
1485
+ );
1486
+
1487
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1488
+ return new Request(
1489
+ 'POST',
1490
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1491
+ $headers,
1492
+ $httpBody
1493
+ );
1494
+ }
1495
+
1496
+ /**
1497
+ * Operation deleteAttribute
1498
+ *
1499
+ * Deletes an attribute
1500
+ *
1501
+ * @param string $attributeCategory Category of the attribute (required)
1502
+ * @param string $attributeName Name of the existing attribute (required)
1503
+ *
1504
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1505
+ * @throws \InvalidArgumentException
1506
+ * @return void
1507
+ */
1508
+ public function deleteAttribute($attributeCategory, $attributeName)
1509
+ {
1510
+ $this->deleteAttributeWithHttpInfo($attributeCategory, $attributeName);
1511
+ }
1512
+
1513
+ /**
1514
+ * Operation deleteAttributeWithHttpInfo
1515
+ *
1516
+ * Deletes an attribute
1517
+ *
1518
+ * @param string $attributeCategory Category of the attribute (required)
1519
+ * @param string $attributeName Name of the existing attribute (required)
1520
+ *
1521
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1522
+ * @throws \InvalidArgumentException
1523
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
1524
+ */
1525
+ public function deleteAttributeWithHttpInfo($attributeCategory, $attributeName)
1526
+ {
1527
+ $returnType = '';
1528
+ $request = $this->deleteAttributeRequest($attributeCategory, $attributeName);
1529
+
1530
+ try {
1531
+ $options = $this->createHttpClientOption();
1532
+ try {
1533
+ $response = $this->client->send($request, $options);
1534
+ } catch (RequestException $e) {
1535
+ throw new ApiException(
1536
+ "[{$e->getCode()}] {$e->getMessage()}",
1537
+ $e->getCode(),
1538
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1539
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1540
+ );
1541
+ }
1542
+
1543
+ $statusCode = $response->getStatusCode();
1544
+
1545
+ if ($statusCode < 200 || $statusCode > 299) {
1546
+ throw new ApiException(
1547
+ sprintf(
1548
+ '[%d] Error connecting to the API (%s)',
1549
+ $statusCode,
1550
+ $request->getUri()
1551
+ ),
1552
+ $statusCode,
1553
+ $response->getHeaders(),
1554
+ $response->getBody()
1555
+ );
1556
+ }
1557
+
1558
+ return [null, $statusCode, $response->getHeaders()];
1559
+
1560
+ } catch (ApiException $e) {
1561
+ switch ($e->getCode()) {
1562
+ case 400:
1563
+ $data = ObjectSerializer::deserialize(
1564
+ $e->getResponseBody(),
1565
+ '\SendinBlue\Client\Model\ErrorModel',
1566
+ $e->getResponseHeaders()
1567
+ );
1568
+ $e->setResponseObject($data);
1569
+ break;
1570
+ case 404:
1571
+ $data = ObjectSerializer::deserialize(
1572
+ $e->getResponseBody(),
1573
+ '\SendinBlue\Client\Model\ErrorModel',
1574
+ $e->getResponseHeaders()
1575
+ );
1576
+ $e->setResponseObject($data);
1577
+ break;
1578
+ }
1579
+ throw $e;
1580
+ }
1581
+ }
1582
+
1583
+ /**
1584
+ * Operation deleteAttributeAsync
1585
+ *
1586
+ * Deletes an attribute
1587
+ *
1588
+ * @param string $attributeCategory Category of the attribute (required)
1589
+ * @param string $attributeName Name of the existing attribute (required)
1590
+ *
1591
+ * @throws \InvalidArgumentException
1592
+ * @return \GuzzleHttp\Promise\PromiseInterface
1593
+ */
1594
+ public function deleteAttributeAsync($attributeCategory, $attributeName)
1595
+ {
1596
+ return $this->deleteAttributeAsyncWithHttpInfo($attributeCategory, $attributeName)
1597
+ ->then(
1598
+ function ($response) {
1599
+ return $response[0];
1600
+ }
1601
+ );
1602
+ }
1603
+
1604
+ /**
1605
+ * Operation deleteAttributeAsyncWithHttpInfo
1606
+ *
1607
+ * Deletes an attribute
1608
+ *
1609
+ * @param string $attributeCategory Category of the attribute (required)
1610
+ * @param string $attributeName Name of the existing attribute (required)
1611
+ *
1612
+ * @throws \InvalidArgumentException
1613
+ * @return \GuzzleHttp\Promise\PromiseInterface
1614
+ */
1615
+ public function deleteAttributeAsyncWithHttpInfo($attributeCategory, $attributeName)
1616
+ {
1617
+ $returnType = '';
1618
+ $request = $this->deleteAttributeRequest($attributeCategory, $attributeName);
1619
+
1620
+ return $this->client
1621
+ ->sendAsync($request, $this->createHttpClientOption())
1622
+ ->then(
1623
+ function ($response) use ($returnType) {
1624
+ return [null, $response->getStatusCode(), $response->getHeaders()];
1625
+ },
1626
+ function ($exception) {
1627
+ $response = $exception->getResponse();
1628
+ $statusCode = $response->getStatusCode();
1629
+ throw new ApiException(
1630
+ sprintf(
1631
+ '[%d] Error connecting to the API (%s)',
1632
+ $statusCode,
1633
+ $exception->getRequest()->getUri()
1634
+ ),
1635
+ $statusCode,
1636
+ $response->getHeaders(),
1637
+ $response->getBody()
1638
+ );
1639
+ }
1640
+ );
1641
+ }
1642
+
1643
+ /**
1644
+ * Create request for operation 'deleteAttribute'
1645
+ *
1646
+ * @param string $attributeCategory Category of the attribute (required)
1647
+ * @param string $attributeName Name of the existing attribute (required)
1648
+ *
1649
+ * @throws \InvalidArgumentException
1650
+ * @return \GuzzleHttp\Psr7\Request
1651
+ */
1652
+ protected function deleteAttributeRequest($attributeCategory, $attributeName)
1653
+ {
1654
+ // verify the required parameter 'attributeCategory' is set
1655
+ if ($attributeCategory === null) {
1656
+ throw new \InvalidArgumentException(
1657
+ 'Missing the required parameter $attributeCategory when calling deleteAttribute'
1658
+ );
1659
+ }
1660
+ // verify the required parameter 'attributeName' is set
1661
+ if ($attributeName === null) {
1662
+ throw new \InvalidArgumentException(
1663
+ 'Missing the required parameter $attributeName when calling deleteAttribute'
1664
+ );
1665
+ }
1666
+
1667
+ $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}';
1668
+ $formParams = [];
1669
+ $queryParams = [];
1670
+ $headerParams = [];
1671
+ $httpBody = '';
1672
+ $multipart = false;
1673
+
1674
+
1675
+ // path params
1676
+ if ($attributeCategory !== null) {
1677
+ $resourcePath = str_replace(
1678
+ '{' . 'attributeCategory' . '}',
1679
+ ObjectSerializer::toPathValue($attributeCategory),
1680
+ $resourcePath
1681
+ );
1682
+ }
1683
+ // path params
1684
+ if ($attributeName !== null) {
1685
+ $resourcePath = str_replace(
1686
+ '{' . 'attributeName' . '}',
1687
+ ObjectSerializer::toPathValue($attributeName),
1688
+ $resourcePath
1689
+ );
1690
+ }
1691
+
1692
+ // body params
1693
+ $_tempBody = null;
1694
+
1695
+ if ($multipart) {
1696
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1697
+ ['application/json']
1698
+ );
1699
+ } else {
1700
+ $headers = $this->headerSelector->selectHeaders(
1701
+ ['application/json'],
1702
+ ['application/json']
1703
+ );
1704
+ }
1705
+
1706
+ // for model (json/xml)
1707
+ if (isset($_tempBody)) {
1708
+ // $_tempBody is the method argument, if present
1709
+ $httpBody = $_tempBody;
1710
+ // \stdClass has no __toString(), so we should encode it manually
1711
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1712
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1713
+ }
1714
+ } elseif (count($formParams) > 0) {
1715
+ if ($multipart) {
1716
+ $multipartContents = [];
1717
+ foreach ($formParams as $formParamName => $formParamValue) {
1718
+ $multipartContents[] = [
1719
+ 'name' => $formParamName,
1720
+ 'contents' => $formParamValue
1721
+ ];
1722
+ }
1723
+ // for HTTP post (form)
1724
+ $httpBody = new MultipartStream($multipartContents);
1725
+
1726
+ } elseif ($headers['Content-Type'] === 'application/json') {
1727
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1728
+
1729
+ } else {
1730
+ // for HTTP post (form)
1731
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1732
+ }
1733
+ }
1734
+
1735
+ // this endpoint requires API key authentication
1736
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1737
+ if ($apiKey !== null) {
1738
+ $headers['api-key'] = $apiKey;
1739
+ }
1740
+ // this endpoint requires API key authentication
1741
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1742
+ if ($apiKey !== null) {
1743
+ $headers['partner-key'] = $apiKey;
1744
+ }
1745
+
1746
+ $defaultHeaders = [];
1747
+ if ($this->config->getUserAgent()) {
1748
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1749
+ }
1750
+
1751
+ $headers = array_merge(
1752
+ $defaultHeaders,
1753
+ $headerParams,
1754
+ $headers
1755
+ );
1756
+
1757
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1758
+ return new Request(
1759
+ 'DELETE',
1760
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1761
+ $headers,
1762
+ $httpBody
1763
+ );
1764
+ }
1765
+
1766
+ /**
1767
+ * Operation deleteContact
1768
+ *
1769
+ * Deletes a contact
1770
+ *
1771
+ * @param string $email Email (urlencoded) of the contact (required)
1772
+ *
1773
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1774
+ * @throws \InvalidArgumentException
1775
+ * @return void
1776
+ */
1777
+ public function deleteContact($email)
1778
+ {
1779
+ $this->deleteContactWithHttpInfo($email);
1780
+ }
1781
+
1782
+ /**
1783
+ * Operation deleteContactWithHttpInfo
1784
+ *
1785
+ * Deletes a contact
1786
+ *
1787
+ * @param string $email Email (urlencoded) of the contact (required)
1788
+ *
1789
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1790
+ * @throws \InvalidArgumentException
1791
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
1792
+ */
1793
+ public function deleteContactWithHttpInfo($email)
1794
+ {
1795
+ $returnType = '';
1796
+ $request = $this->deleteContactRequest($email);
1797
+
1798
+ try {
1799
+ $options = $this->createHttpClientOption();
1800
+ try {
1801
+ $response = $this->client->send($request, $options);
1802
+ } catch (RequestException $e) {
1803
+ throw new ApiException(
1804
+ "[{$e->getCode()}] {$e->getMessage()}",
1805
+ $e->getCode(),
1806
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1807
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1808
+ );
1809
+ }
1810
+
1811
+ $statusCode = $response->getStatusCode();
1812
+
1813
+ if ($statusCode < 200 || $statusCode > 299) {
1814
+ throw new ApiException(
1815
+ sprintf(
1816
+ '[%d] Error connecting to the API (%s)',
1817
+ $statusCode,
1818
+ $request->getUri()
1819
+ ),
1820
+ $statusCode,
1821
+ $response->getHeaders(),
1822
+ $response->getBody()
1823
+ );
1824
+ }
1825
+
1826
+ return [null, $statusCode, $response->getHeaders()];
1827
+
1828
+ } catch (ApiException $e) {
1829
+ switch ($e->getCode()) {
1830
+ case 400:
1831
+ $data = ObjectSerializer::deserialize(
1832
+ $e->getResponseBody(),
1833
+ '\SendinBlue\Client\Model\ErrorModel',
1834
+ $e->getResponseHeaders()
1835
+ );
1836
+ $e->setResponseObject($data);
1837
+ break;
1838
+ case 404:
1839
+ $data = ObjectSerializer::deserialize(
1840
+ $e->getResponseBody(),
1841
+ '\SendinBlue\Client\Model\ErrorModel',
1842
+ $e->getResponseHeaders()
1843
+ );
1844
+ $e->setResponseObject($data);
1845
+ break;
1846
+ case 405:
1847
+ $data = ObjectSerializer::deserialize(
1848
+ $e->getResponseBody(),
1849
+ '\SendinBlue\Client\Model\ErrorModel',
1850
+ $e->getResponseHeaders()
1851
+ );
1852
+ $e->setResponseObject($data);
1853
+ break;
1854
+ }
1855
+ throw $e;
1856
+ }
1857
+ }
1858
+
1859
+ /**
1860
+ * Operation deleteContactAsync
1861
+ *
1862
+ * Deletes a contact
1863
+ *
1864
+ * @param string $email Email (urlencoded) of the contact (required)
1865
+ *
1866
+ * @throws \InvalidArgumentException
1867
+ * @return \GuzzleHttp\Promise\PromiseInterface
1868
+ */
1869
+ public function deleteContactAsync($email)
1870
+ {
1871
+ return $this->deleteContactAsyncWithHttpInfo($email)
1872
+ ->then(
1873
+ function ($response) {
1874
+ return $response[0];
1875
+ }
1876
+ );
1877
+ }
1878
+
1879
+ /**
1880
+ * Operation deleteContactAsyncWithHttpInfo
1881
+ *
1882
+ * Deletes a contact
1883
+ *
1884
+ * @param string $email Email (urlencoded) of the contact (required)
1885
+ *
1886
+ * @throws \InvalidArgumentException
1887
+ * @return \GuzzleHttp\Promise\PromiseInterface
1888
+ */
1889
+ public function deleteContactAsyncWithHttpInfo($email)
1890
+ {
1891
+ $returnType = '';
1892
+ $request = $this->deleteContactRequest($email);
1893
+
1894
+ return $this->client
1895
+ ->sendAsync($request, $this->createHttpClientOption())
1896
+ ->then(
1897
+ function ($response) use ($returnType) {
1898
+ return [null, $response->getStatusCode(), $response->getHeaders()];
1899
+ },
1900
+ function ($exception) {
1901
+ $response = $exception->getResponse();
1902
+ $statusCode = $response->getStatusCode();
1903
+ throw new ApiException(
1904
+ sprintf(
1905
+ '[%d] Error connecting to the API (%s)',
1906
+ $statusCode,
1907
+ $exception->getRequest()->getUri()
1908
+ ),
1909
+ $statusCode,
1910
+ $response->getHeaders(),
1911
+ $response->getBody()
1912
+ );
1913
+ }
1914
+ );
1915
+ }
1916
+
1917
+ /**
1918
+ * Create request for operation 'deleteContact'
1919
+ *
1920
+ * @param string $email Email (urlencoded) of the contact (required)
1921
+ *
1922
+ * @throws \InvalidArgumentException
1923
+ * @return \GuzzleHttp\Psr7\Request
1924
+ */
1925
+ protected function deleteContactRequest($email)
1926
+ {
1927
+ // verify the required parameter 'email' is set
1928
+ if ($email === null) {
1929
+ throw new \InvalidArgumentException(
1930
+ 'Missing the required parameter $email when calling deleteContact'
1931
+ );
1932
+ }
1933
+
1934
+ $resourcePath = '/contacts/{email}';
1935
+ $formParams = [];
1936
+ $queryParams = [];
1937
+ $headerParams = [];
1938
+ $httpBody = '';
1939
+ $multipart = false;
1940
+
1941
+
1942
+ // path params
1943
+ if ($email !== null) {
1944
+ $resourcePath = str_replace(
1945
+ '{' . 'email' . '}',
1946
+ ObjectSerializer::toPathValue($email),
1947
+ $resourcePath
1948
+ );
1949
+ }
1950
+
1951
+ // body params
1952
+ $_tempBody = null;
1953
+
1954
+ if ($multipart) {
1955
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1956
+ ['application/json']
1957
+ );
1958
+ } else {
1959
+ $headers = $this->headerSelector->selectHeaders(
1960
+ ['application/json'],
1961
+ ['application/json']
1962
+ );
1963
+ }
1964
+
1965
+ // for model (json/xml)
1966
+ if (isset($_tempBody)) {
1967
+ // $_tempBody is the method argument, if present
1968
+ $httpBody = $_tempBody;
1969
+ // \stdClass has no __toString(), so we should encode it manually
1970
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1971
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1972
+ }
1973
+ } elseif (count($formParams) > 0) {
1974
+ if ($multipart) {
1975
+ $multipartContents = [];
1976
+ foreach ($formParams as $formParamName => $formParamValue) {
1977
+ $multipartContents[] = [
1978
+ 'name' => $formParamName,
1979
+ 'contents' => $formParamValue
1980
+ ];
1981
+ }
1982
+ // for HTTP post (form)
1983
+ $httpBody = new MultipartStream($multipartContents);
1984
+
1985
+ } elseif ($headers['Content-Type'] === 'application/json') {
1986
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1987
+
1988
+ } else {
1989
+ // for HTTP post (form)
1990
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1991
+ }
1992
+ }
1993
+
1994
+ // this endpoint requires API key authentication
1995
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1996
+ if ($apiKey !== null) {
1997
+ $headers['api-key'] = $apiKey;
1998
+ }
1999
+ // this endpoint requires API key authentication
2000
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2001
+ if ($apiKey !== null) {
2002
+ $headers['partner-key'] = $apiKey;
2003
+ }
2004
+
2005
+ $defaultHeaders = [];
2006
+ if ($this->config->getUserAgent()) {
2007
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2008
+ }
2009
+
2010
+ $headers = array_merge(
2011
+ $defaultHeaders,
2012
+ $headerParams,
2013
+ $headers
2014
+ );
2015
+
2016
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2017
+ return new Request(
2018
+ 'DELETE',
2019
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2020
+ $headers,
2021
+ $httpBody
2022
+ );
2023
+ }
2024
+
2025
+ /**
2026
+ * Operation deleteFolder
2027
+ *
2028
+ * Delete a folder (and all its lists)
2029
+ *
2030
+ * @param int $folderId Id of the folder (required)
2031
+ *
2032
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2033
+ * @throws \InvalidArgumentException
2034
+ * @return void
2035
+ */
2036
+ public function deleteFolder($folderId)
2037
+ {
2038
+ $this->deleteFolderWithHttpInfo($folderId);
2039
+ }
2040
+
2041
+ /**
2042
+ * Operation deleteFolderWithHttpInfo
2043
+ *
2044
+ * Delete a folder (and all its lists)
2045
+ *
2046
+ * @param int $folderId Id of the folder (required)
2047
+ *
2048
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2049
+ * @throws \InvalidArgumentException
2050
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
2051
+ */
2052
+ public function deleteFolderWithHttpInfo($folderId)
2053
+ {
2054
+ $returnType = '';
2055
+ $request = $this->deleteFolderRequest($folderId);
2056
+
2057
+ try {
2058
+ $options = $this->createHttpClientOption();
2059
+ try {
2060
+ $response = $this->client->send($request, $options);
2061
+ } catch (RequestException $e) {
2062
+ throw new ApiException(
2063
+ "[{$e->getCode()}] {$e->getMessage()}",
2064
+ $e->getCode(),
2065
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2066
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2067
+ );
2068
+ }
2069
+
2070
+ $statusCode = $response->getStatusCode();
2071
+
2072
+ if ($statusCode < 200 || $statusCode > 299) {
2073
+ throw new ApiException(
2074
+ sprintf(
2075
+ '[%d] Error connecting to the API (%s)',
2076
+ $statusCode,
2077
+ $request->getUri()
2078
+ ),
2079
+ $statusCode,
2080
+ $response->getHeaders(),
2081
+ $response->getBody()
2082
+ );
2083
+ }
2084
+
2085
+ return [null, $statusCode, $response->getHeaders()];
2086
+
2087
+ } catch (ApiException $e) {
2088
+ switch ($e->getCode()) {
2089
+ case 400:
2090
+ $data = ObjectSerializer::deserialize(
2091
+ $e->getResponseBody(),
2092
+ '\SendinBlue\Client\Model\ErrorModel',
2093
+ $e->getResponseHeaders()
2094
+ );
2095
+ $e->setResponseObject($data);
2096
+ break;
2097
+ case 404:
2098
+ $data = ObjectSerializer::deserialize(
2099
+ $e->getResponseBody(),
2100
+ '\SendinBlue\Client\Model\ErrorModel',
2101
+ $e->getResponseHeaders()
2102
+ );
2103
+ $e->setResponseObject($data);
2104
+ break;
2105
+ }
2106
+ throw $e;
2107
+ }
2108
+ }
2109
+
2110
+ /**
2111
+ * Operation deleteFolderAsync
2112
+ *
2113
+ * Delete a folder (and all its lists)
2114
+ *
2115
+ * @param int $folderId Id of the folder (required)
2116
+ *
2117
+ * @throws \InvalidArgumentException
2118
+ * @return \GuzzleHttp\Promise\PromiseInterface
2119
+ */
2120
+ public function deleteFolderAsync($folderId)
2121
+ {
2122
+ return $this->deleteFolderAsyncWithHttpInfo($folderId)
2123
+ ->then(
2124
+ function ($response) {
2125
+ return $response[0];
2126
+ }
2127
+ );
2128
+ }
2129
+
2130
+ /**
2131
+ * Operation deleteFolderAsyncWithHttpInfo
2132
+ *
2133
+ * Delete a folder (and all its lists)
2134
+ *
2135
+ * @param int $folderId Id of the folder (required)
2136
+ *
2137
+ * @throws \InvalidArgumentException
2138
+ * @return \GuzzleHttp\Promise\PromiseInterface
2139
+ */
2140
+ public function deleteFolderAsyncWithHttpInfo($folderId)
2141
+ {
2142
+ $returnType = '';
2143
+ $request = $this->deleteFolderRequest($folderId);
2144
+
2145
+ return $this->client
2146
+ ->sendAsync($request, $this->createHttpClientOption())
2147
+ ->then(
2148
+ function ($response) use ($returnType) {
2149
+ return [null, $response->getStatusCode(), $response->getHeaders()];
2150
+ },
2151
+ function ($exception) {
2152
+ $response = $exception->getResponse();
2153
+ $statusCode = $response->getStatusCode();
2154
+ throw new ApiException(
2155
+ sprintf(
2156
+ '[%d] Error connecting to the API (%s)',
2157
+ $statusCode,
2158
+ $exception->getRequest()->getUri()
2159
+ ),
2160
+ $statusCode,
2161
+ $response->getHeaders(),
2162
+ $response->getBody()
2163
+ );
2164
+ }
2165
+ );
2166
+ }
2167
+
2168
+ /**
2169
+ * Create request for operation 'deleteFolder'
2170
+ *
2171
+ * @param int $folderId Id of the folder (required)
2172
+ *
2173
+ * @throws \InvalidArgumentException
2174
+ * @return \GuzzleHttp\Psr7\Request
2175
+ */
2176
+ protected function deleteFolderRequest($folderId)
2177
+ {
2178
+ // verify the required parameter 'folderId' is set
2179
+ if ($folderId === null) {
2180
+ throw new \InvalidArgumentException(
2181
+ 'Missing the required parameter $folderId when calling deleteFolder'
2182
+ );
2183
+ }
2184
+
2185
+ $resourcePath = '/contacts/folders/{folderId}';
2186
+ $formParams = [];
2187
+ $queryParams = [];
2188
+ $headerParams = [];
2189
+ $httpBody = '';
2190
+ $multipart = false;
2191
+
2192
+
2193
+ // path params
2194
+ if ($folderId !== null) {
2195
+ $resourcePath = str_replace(
2196
+ '{' . 'folderId' . '}',
2197
+ ObjectSerializer::toPathValue($folderId),
2198
+ $resourcePath
2199
+ );
2200
+ }
2201
+
2202
+ // body params
2203
+ $_tempBody = null;
2204
+
2205
+ if ($multipart) {
2206
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2207
+ ['application/json']
2208
+ );
2209
+ } else {
2210
+ $headers = $this->headerSelector->selectHeaders(
2211
+ ['application/json'],
2212
+ ['application/json']
2213
+ );
2214
+ }
2215
+
2216
+ // for model (json/xml)
2217
+ if (isset($_tempBody)) {
2218
+ // $_tempBody is the method argument, if present
2219
+ $httpBody = $_tempBody;
2220
+ // \stdClass has no __toString(), so we should encode it manually
2221
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
2222
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
2223
+ }
2224
+ } elseif (count($formParams) > 0) {
2225
+ if ($multipart) {
2226
+ $multipartContents = [];
2227
+ foreach ($formParams as $formParamName => $formParamValue) {
2228
+ $multipartContents[] = [
2229
+ 'name' => $formParamName,
2230
+ 'contents' => $formParamValue
2231
+ ];
2232
+ }
2233
+ // for HTTP post (form)
2234
+ $httpBody = new MultipartStream($multipartContents);
2235
+
2236
+ } elseif ($headers['Content-Type'] === 'application/json') {
2237
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2238
+
2239
+ } else {
2240
+ // for HTTP post (form)
2241
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2242
+ }
2243
+ }
2244
+
2245
+ // this endpoint requires API key authentication
2246
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2247
+ if ($apiKey !== null) {
2248
+ $headers['api-key'] = $apiKey;
2249
+ }
2250
+ // this endpoint requires API key authentication
2251
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2252
+ if ($apiKey !== null) {
2253
+ $headers['partner-key'] = $apiKey;
2254
+ }
2255
+
2256
+ $defaultHeaders = [];
2257
+ if ($this->config->getUserAgent()) {
2258
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2259
+ }
2260
+
2261
+ $headers = array_merge(
2262
+ $defaultHeaders,
2263
+ $headerParams,
2264
+ $headers
2265
+ );
2266
+
2267
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2268
+ return new Request(
2269
+ 'DELETE',
2270
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2271
+ $headers,
2272
+ $httpBody
2273
+ );
2274
+ }
2275
+
2276
+ /**
2277
+ * Operation deleteList
2278
+ *
2279
+ * Delete a list
2280
+ *
2281
+ * @param int $listId Id of the list (required)
2282
+ *
2283
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2284
+ * @throws \InvalidArgumentException
2285
+ * @return void
2286
+ */
2287
+ public function deleteList($listId)
2288
+ {
2289
+ $this->deleteListWithHttpInfo($listId);
2290
+ }
2291
+
2292
+ /**
2293
+ * Operation deleteListWithHttpInfo
2294
+ *
2295
+ * Delete a list
2296
+ *
2297
+ * @param int $listId Id of the list (required)
2298
+ *
2299
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2300
+ * @throws \InvalidArgumentException
2301
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
2302
+ */
2303
+ public function deleteListWithHttpInfo($listId)
2304
+ {
2305
+ $returnType = '';
2306
+ $request = $this->deleteListRequest($listId);
2307
+
2308
+ try {
2309
+ $options = $this->createHttpClientOption();
2310
+ try {
2311
+ $response = $this->client->send($request, $options);
2312
+ } catch (RequestException $e) {
2313
+ throw new ApiException(
2314
+ "[{$e->getCode()}] {$e->getMessage()}",
2315
+ $e->getCode(),
2316
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2317
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2318
+ );
2319
+ }
2320
+
2321
+ $statusCode = $response->getStatusCode();
2322
+
2323
+ if ($statusCode < 200 || $statusCode > 299) {
2324
+ throw new ApiException(
2325
+ sprintf(
2326
+ '[%d] Error connecting to the API (%s)',
2327
+ $statusCode,
2328
+ $request->getUri()
2329
+ ),
2330
+ $statusCode,
2331
+ $response->getHeaders(),
2332
+ $response->getBody()
2333
+ );
2334
+ }
2335
+
2336
+ return [null, $statusCode, $response->getHeaders()];
2337
+
2338
+ } catch (ApiException $e) {
2339
+ switch ($e->getCode()) {
2340
+ case 400:
2341
+ $data = ObjectSerializer::deserialize(
2342
+ $e->getResponseBody(),
2343
+ '\SendinBlue\Client\Model\ErrorModel',
2344
+ $e->getResponseHeaders()
2345
+ );
2346
+ $e->setResponseObject($data);
2347
+ break;
2348
+ case 404:
2349
+ $data = ObjectSerializer::deserialize(
2350
+ $e->getResponseBody(),
2351
+ '\SendinBlue\Client\Model\ErrorModel',
2352
+ $e->getResponseHeaders()
2353
+ );
2354
+ $e->setResponseObject($data);
2355
+ break;
2356
+ }
2357
+ throw $e;
2358
+ }
2359
+ }
2360
+
2361
+ /**
2362
+ * Operation deleteListAsync
2363
+ *
2364
+ * Delete a list
2365
+ *
2366
+ * @param int $listId Id of the list (required)
2367
+ *
2368
+ * @throws \InvalidArgumentException
2369
+ * @return \GuzzleHttp\Promise\PromiseInterface
2370
+ */
2371
+ public function deleteListAsync($listId)
2372
+ {
2373
+ return $this->deleteListAsyncWithHttpInfo($listId)
2374
+ ->then(
2375
+ function ($response) {
2376
+ return $response[0];
2377
+ }
2378
+ );
2379
+ }
2380
+
2381
+ /**
2382
+ * Operation deleteListAsyncWithHttpInfo
2383
+ *
2384
+ * Delete a list
2385
+ *
2386
+ * @param int $listId Id of the list (required)
2387
+ *
2388
+ * @throws \InvalidArgumentException
2389
+ * @return \GuzzleHttp\Promise\PromiseInterface
2390
+ */
2391
+ public function deleteListAsyncWithHttpInfo($listId)
2392
+ {
2393
+ $returnType = '';
2394
+ $request = $this->deleteListRequest($listId);
2395
+
2396
+ return $this->client
2397
+ ->sendAsync($request, $this->createHttpClientOption())
2398
+ ->then(
2399
+ function ($response) use ($returnType) {
2400
+ return [null, $response->getStatusCode(), $response->getHeaders()];
2401
+ },
2402
+ function ($exception) {
2403
+ $response = $exception->getResponse();
2404
+ $statusCode = $response->getStatusCode();
2405
+ throw new ApiException(
2406
+ sprintf(
2407
+ '[%d] Error connecting to the API (%s)',
2408
+ $statusCode,
2409
+ $exception->getRequest()->getUri()
2410
+ ),
2411
+ $statusCode,
2412
+ $response->getHeaders(),
2413
+ $response->getBody()
2414
+ );
2415
+ }
2416
+ );
2417
+ }
2418
+
2419
+ /**
2420
+ * Create request for operation 'deleteList'
2421
+ *
2422
+ * @param int $listId Id of the list (required)
2423
+ *
2424
+ * @throws \InvalidArgumentException
2425
+ * @return \GuzzleHttp\Psr7\Request
2426
+ */
2427
+ protected function deleteListRequest($listId)
2428
+ {
2429
+ // verify the required parameter 'listId' is set
2430
+ if ($listId === null) {
2431
+ throw new \InvalidArgumentException(
2432
+ 'Missing the required parameter $listId when calling deleteList'
2433
+ );
2434
+ }
2435
+
2436
+ $resourcePath = '/contacts/lists/{listId}';
2437
+ $formParams = [];
2438
+ $queryParams = [];
2439
+ $headerParams = [];
2440
+ $httpBody = '';
2441
+ $multipart = false;
2442
+
2443
+
2444
+ // path params
2445
+ if ($listId !== null) {
2446
+ $resourcePath = str_replace(
2447
+ '{' . 'listId' . '}',
2448
+ ObjectSerializer::toPathValue($listId),
2449
+ $resourcePath
2450
+ );
2451
+ }
2452
+
2453
+ // body params
2454
+ $_tempBody = null;
2455
+
2456
+ if ($multipart) {
2457
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2458
+ ['application/json']
2459
+ );
2460
+ } else {
2461
+ $headers = $this->headerSelector->selectHeaders(
2462
+ ['application/json'],
2463
+ ['application/json']
2464
+ );
2465
+ }
2466
+
2467
+ // for model (json/xml)
2468
+ if (isset($_tempBody)) {
2469
+ // $_tempBody is the method argument, if present
2470
+ $httpBody = $_tempBody;
2471
+ // \stdClass has no __toString(), so we should encode it manually
2472
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
2473
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
2474
+ }
2475
+ } elseif (count($formParams) > 0) {
2476
+ if ($multipart) {
2477
+ $multipartContents = [];
2478
+ foreach ($formParams as $formParamName => $formParamValue) {
2479
+ $multipartContents[] = [
2480
+ 'name' => $formParamName,
2481
+ 'contents' => $formParamValue
2482
+ ];
2483
+ }
2484
+ // for HTTP post (form)
2485
+ $httpBody = new MultipartStream($multipartContents);
2486
+
2487
+ } elseif ($headers['Content-Type'] === 'application/json') {
2488
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2489
+
2490
+ } else {
2491
+ // for HTTP post (form)
2492
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2493
+ }
2494
+ }
2495
+
2496
+ // this endpoint requires API key authentication
2497
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2498
+ if ($apiKey !== null) {
2499
+ $headers['api-key'] = $apiKey;
2500
+ }
2501
+ // this endpoint requires API key authentication
2502
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2503
+ if ($apiKey !== null) {
2504
+ $headers['partner-key'] = $apiKey;
2505
+ }
2506
+
2507
+ $defaultHeaders = [];
2508
+ if ($this->config->getUserAgent()) {
2509
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2510
+ }
2511
+
2512
+ $headers = array_merge(
2513
+ $defaultHeaders,
2514
+ $headerParams,
2515
+ $headers
2516
+ );
2517
+
2518
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2519
+ return new Request(
2520
+ 'DELETE',
2521
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2522
+ $headers,
2523
+ $httpBody
2524
+ );
2525
+ }
2526
+
2527
+ /**
2528
+ * Operation getAttributes
2529
+ *
2530
+ * Lists all attributes
2531
+ *
2532
+ *
2533
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2534
+ * @throws \InvalidArgumentException
2535
+ * @return \SendinBlue\Client\Model\GetAttributes
2536
+ */
2537
+ public function getAttributes()
2538
+ {
2539
+ list($response) = $this->getAttributesWithHttpInfo();
2540
+ return $response;
2541
+ }
2542
+
2543
+ /**
2544
+ * Operation getAttributesWithHttpInfo
2545
+ *
2546
+ * Lists all attributes
2547
+ *
2548
+ *
2549
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2550
+ * @throws \InvalidArgumentException
2551
+ * @return array of \SendinBlue\Client\Model\GetAttributes, HTTP status code, HTTP response headers (array of strings)
2552
+ */
2553
+ public function getAttributesWithHttpInfo()
2554
+ {
2555
+ $returnType = '\SendinBlue\Client\Model\GetAttributes';
2556
+ $request = $this->getAttributesRequest();
2557
+
2558
+ try {
2559
+ $options = $this->createHttpClientOption();
2560
+ try {
2561
+ $response = $this->client->send($request, $options);
2562
+ } catch (RequestException $e) {
2563
+ throw new ApiException(
2564
+ "[{$e->getCode()}] {$e->getMessage()}",
2565
+ $e->getCode(),
2566
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2567
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2568
+ );
2569
+ }
2570
+
2571
+ $statusCode = $response->getStatusCode();
2572
+
2573
+ if ($statusCode < 200 || $statusCode > 299) {
2574
+ throw new ApiException(
2575
+ sprintf(
2576
+ '[%d] Error connecting to the API (%s)',
2577
+ $statusCode,
2578
+ $request->getUri()
2579
+ ),
2580
+ $statusCode,
2581
+ $response->getHeaders(),
2582
+ $response->getBody()
2583
+ );
2584
+ }
2585
+
2586
+ $responseBody = $response->getBody();
2587
+ if ($returnType === '\SplFileObject') {
2588
+ $content = $responseBody; //stream goes to serializer
2589
+ } else {
2590
+ $content = $responseBody->getContents();
2591
+ if ($returnType !== 'string') {
2592
+ $content = json_decode($content);
2593
+ }
2594
+ }
2595
+
2596
+ return [
2597
+ ObjectSerializer::deserialize($content, $returnType, []),
2598
+ $response->getStatusCode(),
2599
+ $response->getHeaders()
2600
+ ];
2601
+
2602
+ } catch (ApiException $e) {
2603
+ switch ($e->getCode()) {
2604
+ case 200:
2605
+ $data = ObjectSerializer::deserialize(
2606
+ $e->getResponseBody(),
2607
+ '\SendinBlue\Client\Model\GetAttributes',
2608
+ $e->getResponseHeaders()
2609
+ );
2610
+ $e->setResponseObject($data);
2611
+ break;
2612
+ }
2613
+ throw $e;
2614
+ }
2615
+ }
2616
+
2617
+ /**
2618
+ * Operation getAttributesAsync
2619
+ *
2620
+ * Lists all attributes
2621
+ *
2622
+ *
2623
+ * @throws \InvalidArgumentException
2624
+ * @return \GuzzleHttp\Promise\PromiseInterface
2625
+ */
2626
+ public function getAttributesAsync()
2627
+ {
2628
+ return $this->getAttributesAsyncWithHttpInfo()
2629
+ ->then(
2630
+ function ($response) {
2631
+ return $response[0];
2632
+ }
2633
+ );
2634
+ }
2635
+
2636
+ /**
2637
+ * Operation getAttributesAsyncWithHttpInfo
2638
+ *
2639
+ * Lists all attributes
2640
+ *
2641
+ *
2642
+ * @throws \InvalidArgumentException
2643
+ * @return \GuzzleHttp\Promise\PromiseInterface
2644
+ */
2645
+ public function getAttributesAsyncWithHttpInfo()
2646
+ {
2647
+ $returnType = '\SendinBlue\Client\Model\GetAttributes';
2648
+ $request = $this->getAttributesRequest();
2649
+
2650
+ return $this->client
2651
+ ->sendAsync($request, $this->createHttpClientOption())
2652
+ ->then(
2653
+ function ($response) use ($returnType) {
2654
+ $responseBody = $response->getBody();
2655
+ if ($returnType === '\SplFileObject') {
2656
+ $content = $responseBody; //stream goes to serializer
2657
+ } else {
2658
+ $content = $responseBody->getContents();
2659
+ if ($returnType !== 'string') {
2660
+ $content = json_decode($content);
2661
+ }
2662
+ }
2663
+
2664
+ return [
2665
+ ObjectSerializer::deserialize($content, $returnType, []),
2666
+ $response->getStatusCode(),
2667
+ $response->getHeaders()
2668
+ ];
2669
+ },
2670
+ function ($exception) {
2671
+ $response = $exception->getResponse();
2672
+ $statusCode = $response->getStatusCode();
2673
+ throw new ApiException(
2674
+ sprintf(
2675
+ '[%d] Error connecting to the API (%s)',
2676
+ $statusCode,
2677
+ $exception->getRequest()->getUri()
2678
+ ),
2679
+ $statusCode,
2680
+ $response->getHeaders(),
2681
+ $response->getBody()
2682
+ );
2683
+ }
2684
+ );
2685
+ }
2686
+
2687
+ /**
2688
+ * Create request for operation 'getAttributes'
2689
+ *
2690
+ *
2691
+ * @throws \InvalidArgumentException
2692
+ * @return \GuzzleHttp\Psr7\Request
2693
+ */
2694
+ protected function getAttributesRequest()
2695
+ {
2696
+
2697
+ $resourcePath = '/contacts/attributes';
2698
+ $formParams = [];
2699
+ $queryParams = [];
2700
+ $headerParams = [];
2701
+ $httpBody = '';
2702
+ $multipart = false;
2703
+
2704
+
2705
+
2706
+ // body params
2707
+ $_tempBody = null;
2708
+
2709
+ if ($multipart) {
2710
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2711
+ ['application/json']
2712
+ );
2713
+ } else {
2714
+ $headers = $this->headerSelector->selectHeaders(
2715
+ ['application/json'],
2716
+ ['application/json']
2717
+ );
2718
+ }
2719
+
2720
+ // for model (json/xml)
2721
+ if (isset($_tempBody)) {
2722
+ // $_tempBody is the method argument, if present
2723
+ $httpBody = $_tempBody;
2724
+ // \stdClass has no __toString(), so we should encode it manually
2725
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
2726
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
2727
+ }
2728
+ } elseif (count($formParams) > 0) {
2729
+ if ($multipart) {
2730
+ $multipartContents = [];
2731
+ foreach ($formParams as $formParamName => $formParamValue) {
2732
+ $multipartContents[] = [
2733
+ 'name' => $formParamName,
2734
+ 'contents' => $formParamValue
2735
+ ];
2736
+ }
2737
+ // for HTTP post (form)
2738
+ $httpBody = new MultipartStream($multipartContents);
2739
+
2740
+ } elseif ($headers['Content-Type'] === 'application/json') {
2741
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2742
+
2743
+ } else {
2744
+ // for HTTP post (form)
2745
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2746
+ }
2747
+ }
2748
+
2749
+ // this endpoint requires API key authentication
2750
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2751
+ if ($apiKey !== null) {
2752
+ $headers['api-key'] = $apiKey;
2753
+ }
2754
+ // this endpoint requires API key authentication
2755
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2756
+ if ($apiKey !== null) {
2757
+ $headers['partner-key'] = $apiKey;
2758
+ }
2759
+
2760
+ $defaultHeaders = [];
2761
+ if ($this->config->getUserAgent()) {
2762
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2763
+ }
2764
+
2765
+ $headers = array_merge(
2766
+ $defaultHeaders,
2767
+ $headerParams,
2768
+ $headers
2769
+ );
2770
+
2771
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2772
+ return new Request(
2773
+ 'GET',
2774
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2775
+ $headers,
2776
+ $httpBody
2777
+ );
2778
+ }
2779
+
2780
+ /**
2781
+ * Operation getContactInfo
2782
+ *
2783
+ * Retrieves contact informations
2784
+ *
2785
+ * @param string $email Email (urlencoded) of the contact OR its SMS attribute value (required)
2786
+ *
2787
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2788
+ * @throws \InvalidArgumentException
2789
+ * @return \SendinBlue\Client\Model\GetExtendedContactDetails
2790
+ */
2791
+ public function getContactInfo($email)
2792
+ {
2793
+ list($response) = $this->getContactInfoWithHttpInfo($email);
2794
+ return $response;
2795
+ }
2796
+
2797
+ /**
2798
+ * Operation getContactInfoWithHttpInfo
2799
+ *
2800
+ * Retrieves contact informations
2801
+ *
2802
+ * @param string $email Email (urlencoded) of the contact OR its SMS attribute value (required)
2803
+ *
2804
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2805
+ * @throws \InvalidArgumentException
2806
+ * @return array of \SendinBlue\Client\Model\GetExtendedContactDetails, HTTP status code, HTTP response headers (array of strings)
2807
+ */
2808
+ public function getContactInfoWithHttpInfo($email)
2809
+ {
2810
+ $returnType = '\SendinBlue\Client\Model\GetExtendedContactDetails';
2811
+ $request = $this->getContactInfoRequest($email);
2812
+
2813
+ try {
2814
+ $options = $this->createHttpClientOption();
2815
+ try {
2816
+ $response = $this->client->send($request, $options);
2817
+ } catch (RequestException $e) {
2818
+ throw new ApiException(
2819
+ "[{$e->getCode()}] {$e->getMessage()}",
2820
+ $e->getCode(),
2821
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2822
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2823
+ );
2824
+ }
2825
+
2826
+ $statusCode = $response->getStatusCode();
2827
+
2828
+ if ($statusCode < 200 || $statusCode > 299) {
2829
+ throw new ApiException(
2830
+ sprintf(
2831
+ '[%d] Error connecting to the API (%s)',
2832
+ $statusCode,
2833
+ $request->getUri()
2834
+ ),
2835
+ $statusCode,
2836
+ $response->getHeaders(),
2837
+ $response->getBody()
2838
+ );
2839
+ }
2840
+
2841
+ $responseBody = $response->getBody();
2842
+ if ($returnType === '\SplFileObject') {
2843
+ $content = $responseBody; //stream goes to serializer
2844
+ } else {
2845
+ $content = $responseBody->getContents();
2846
+ if ($returnType !== 'string') {
2847
+ $content = json_decode($content);
2848
+ }
2849
+ }
2850
+
2851
+ return [
2852
+ ObjectSerializer::deserialize($content, $returnType, []),
2853
+ $response->getStatusCode(),
2854
+ $response->getHeaders()
2855
+ ];
2856
+
2857
+ } catch (ApiException $e) {
2858
+ switch ($e->getCode()) {
2859
+ case 200:
2860
+ $data = ObjectSerializer::deserialize(
2861
+ $e->getResponseBody(),
2862
+ '\SendinBlue\Client\Model\GetExtendedContactDetails',
2863
+ $e->getResponseHeaders()
2864
+ );
2865
+ $e->setResponseObject($data);
2866
+ break;
2867
+ case 400:
2868
+ $data = ObjectSerializer::deserialize(
2869
+ $e->getResponseBody(),
2870
+ '\SendinBlue\Client\Model\ErrorModel',
2871
+ $e->getResponseHeaders()
2872
+ );
2873
+ $e->setResponseObject($data);
2874
+ break;
2875
+ case 404:
2876
+ $data = ObjectSerializer::deserialize(
2877
+ $e->getResponseBody(),
2878
+ '\SendinBlue\Client\Model\ErrorModel',
2879
+ $e->getResponseHeaders()
2880
+ );
2881
+ $e->setResponseObject($data);
2882
+ break;
2883
+ }
2884
+ throw $e;
2885
+ }
2886
+ }
2887
+
2888
+ /**
2889
+ * Operation getContactInfoAsync
2890
+ *
2891
+ * Retrieves contact informations
2892
+ *
2893
+ * @param string $email Email (urlencoded) of the contact OR its SMS attribute value (required)
2894
+ *
2895
+ * @throws \InvalidArgumentException
2896
+ * @return \GuzzleHttp\Promise\PromiseInterface
2897
+ */
2898
+ public function getContactInfoAsync($email)
2899
+ {
2900
+ return $this->getContactInfoAsyncWithHttpInfo($email)
2901
+ ->then(
2902
+ function ($response) {
2903
+ return $response[0];
2904
+ }
2905
+ );
2906
+ }
2907
+
2908
+ /**
2909
+ * Operation getContactInfoAsyncWithHttpInfo
2910
+ *
2911
+ * Retrieves contact informations
2912
+ *
2913
+ * @param string $email Email (urlencoded) of the contact OR its SMS attribute value (required)
2914
+ *
2915
+ * @throws \InvalidArgumentException
2916
+ * @return \GuzzleHttp\Promise\PromiseInterface
2917
+ */
2918
+ public function getContactInfoAsyncWithHttpInfo($email)
2919
+ {
2920
+ $returnType = '\SendinBlue\Client\Model\GetExtendedContactDetails';
2921
+ $request = $this->getContactInfoRequest($email);
2922
+
2923
+ return $this->client
2924
+ ->sendAsync($request, $this->createHttpClientOption())
2925
+ ->then(
2926
+ function ($response) use ($returnType) {
2927
+ $responseBody = $response->getBody();
2928
+ if ($returnType === '\SplFileObject') {
2929
+ $content = $responseBody; //stream goes to serializer
2930
+ } else {
2931
+ $content = $responseBody->getContents();
2932
+ if ($returnType !== 'string') {
2933
+ $content = json_decode($content);
2934
+ }
2935
+ }
2936
+
2937
+ return [
2938
+ ObjectSerializer::deserialize($content, $returnType, []),
2939
+ $response->getStatusCode(),
2940
+ $response->getHeaders()
2941
+ ];
2942
+ },
2943
+ function ($exception) {
2944
+ $response = $exception->getResponse();
2945
+ $statusCode = $response->getStatusCode();
2946
+ throw new ApiException(
2947
+ sprintf(
2948
+ '[%d] Error connecting to the API (%s)',
2949
+ $statusCode,
2950
+ $exception->getRequest()->getUri()
2951
+ ),
2952
+ $statusCode,
2953
+ $response->getHeaders(),
2954
+ $response->getBody()
2955
+ );
2956
+ }
2957
+ );
2958
+ }
2959
+
2960
+ /**
2961
+ * Create request for operation 'getContactInfo'
2962
+ *
2963
+ * @param string $email Email (urlencoded) of the contact OR its SMS attribute value (required)
2964
+ *
2965
+ * @throws \InvalidArgumentException
2966
+ * @return \GuzzleHttp\Psr7\Request
2967
+ */
2968
+ protected function getContactInfoRequest($email)
2969
+ {
2970
+ // verify the required parameter 'email' is set
2971
+ if ($email === null) {
2972
+ throw new \InvalidArgumentException(
2973
+ 'Missing the required parameter $email when calling getContactInfo'
2974
+ );
2975
+ }
2976
+
2977
+ $resourcePath = '/contacts/{email}';
2978
+ $formParams = [];
2979
+ $queryParams = [];
2980
+ $headerParams = [];
2981
+ $httpBody = '';
2982
+ $multipart = false;
2983
+
2984
+
2985
+ // path params
2986
+ if ($email !== null) {
2987
+ $resourcePath = str_replace(
2988
+ '{' . 'email' . '}',
2989
+ ObjectSerializer::toPathValue($email),
2990
+ $resourcePath
2991
+ );
2992
+ }
2993
+
2994
+ // body params
2995
+ $_tempBody = null;
2996
+
2997
+ if ($multipart) {
2998
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2999
+ ['application/json']
3000
+ );
3001
+ } else {
3002
+ $headers = $this->headerSelector->selectHeaders(
3003
+ ['application/json'],
3004
+ ['application/json']
3005
+ );
3006
+ }
3007
+
3008
+ // for model (json/xml)
3009
+ if (isset($_tempBody)) {
3010
+ // $_tempBody is the method argument, if present
3011
+ $httpBody = $_tempBody;
3012
+ // \stdClass has no __toString(), so we should encode it manually
3013
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
3014
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
3015
+ }
3016
+ } elseif (count($formParams) > 0) {
3017
+ if ($multipart) {
3018
+ $multipartContents = [];
3019
+ foreach ($formParams as $formParamName => $formParamValue) {
3020
+ $multipartContents[] = [
3021
+ 'name' => $formParamName,
3022
+ 'contents' => $formParamValue
3023
+ ];
3024
+ }
3025
+ // for HTTP post (form)
3026
+ $httpBody = new MultipartStream($multipartContents);
3027
+
3028
+ } elseif ($headers['Content-Type'] === 'application/json') {
3029
+ $httpBody = \GuzzleHttp\json_encode($formParams);
3030
+
3031
+ } else {
3032
+ // for HTTP post (form)
3033
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
3034
+ }
3035
+ }
3036
+
3037
+ // this endpoint requires API key authentication
3038
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
3039
+ if ($apiKey !== null) {
3040
+ $headers['api-key'] = $apiKey;
3041
+ }
3042
+ // this endpoint requires API key authentication
3043
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
3044
+ if ($apiKey !== null) {
3045
+ $headers['partner-key'] = $apiKey;
3046
+ }
3047
+
3048
+ $defaultHeaders = [];
3049
+ if ($this->config->getUserAgent()) {
3050
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
3051
+ }
3052
+
3053
+ $headers = array_merge(
3054
+ $defaultHeaders,
3055
+ $headerParams,
3056
+ $headers
3057
+ );
3058
+
3059
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
3060
+ return new Request(
3061
+ 'GET',
3062
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
3063
+ $headers,
3064
+ $httpBody
3065
+ );
3066
+ }
3067
+
3068
+ /**
3069
+ * Operation getContactStats
3070
+ *
3071
+ * Get the campaigns statistics for a contact
3072
+ *
3073
+ * @param string $email Email address (urlencoded) of the contact (required)
3074
+ *
3075
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3076
+ * @throws \InvalidArgumentException
3077
+ * @return \SendinBlue\Client\Model\GetContactCampaignStats
3078
+ */
3079
+ public function getContactStats($email)
3080
+ {
3081
+ list($response) = $this->getContactStatsWithHttpInfo($email);
3082
+ return $response;
3083
+ }
3084
+
3085
+ /**
3086
+ * Operation getContactStatsWithHttpInfo
3087
+ *
3088
+ * Get the campaigns statistics for a contact
3089
+ *
3090
+ * @param string $email Email address (urlencoded) of the contact (required)
3091
+ *
3092
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3093
+ * @throws \InvalidArgumentException
3094
+ * @return array of \SendinBlue\Client\Model\GetContactCampaignStats, HTTP status code, HTTP response headers (array of strings)
3095
+ */
3096
+ public function getContactStatsWithHttpInfo($email)
3097
+ {
3098
+ $returnType = '\SendinBlue\Client\Model\GetContactCampaignStats';
3099
+ $request = $this->getContactStatsRequest($email);
3100
+
3101
+ try {
3102
+ $options = $this->createHttpClientOption();
3103
+ try {
3104
+ $response = $this->client->send($request, $options);
3105
+ } catch (RequestException $e) {
3106
+ throw new ApiException(
3107
+ "[{$e->getCode()}] {$e->getMessage()}",
3108
+ $e->getCode(),
3109
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
3110
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
3111
+ );
3112
+ }
3113
+
3114
+ $statusCode = $response->getStatusCode();
3115
+
3116
+ if ($statusCode < 200 || $statusCode > 299) {
3117
+ throw new ApiException(
3118
+ sprintf(
3119
+ '[%d] Error connecting to the API (%s)',
3120
+ $statusCode,
3121
+ $request->getUri()
3122
+ ),
3123
+ $statusCode,
3124
+ $response->getHeaders(),
3125
+ $response->getBody()
3126
+ );
3127
+ }
3128
+
3129
+ $responseBody = $response->getBody();
3130
+ if ($returnType === '\SplFileObject') {
3131
+ $content = $responseBody; //stream goes to serializer
3132
+ } else {
3133
+ $content = $responseBody->getContents();
3134
+ if ($returnType !== 'string') {
3135
+ $content = json_decode($content);
3136
+ }
3137
+ }
3138
+
3139
+ return [
3140
+ ObjectSerializer::deserialize($content, $returnType, []),
3141
+ $response->getStatusCode(),
3142
+ $response->getHeaders()
3143
+ ];
3144
+
3145
+ } catch (ApiException $e) {
3146
+ switch ($e->getCode()) {
3147
+ case 200:
3148
+ $data = ObjectSerializer::deserialize(
3149
+ $e->getResponseBody(),
3150
+ '\SendinBlue\Client\Model\GetContactCampaignStats',
3151
+ $e->getResponseHeaders()
3152
+ );
3153
+ $e->setResponseObject($data);
3154
+ break;
3155
+ case 400:
3156
+ $data = ObjectSerializer::deserialize(
3157
+ $e->getResponseBody(),
3158
+ '\SendinBlue\Client\Model\ErrorModel',
3159
+ $e->getResponseHeaders()
3160
+ );
3161
+ $e->setResponseObject($data);
3162
+ break;
3163
+ case 404:
3164
+ $data = ObjectSerializer::deserialize(
3165
+ $e->getResponseBody(),
3166
+ '\SendinBlue\Client\Model\ErrorModel',
3167
+ $e->getResponseHeaders()
3168
+ );
3169
+ $e->setResponseObject($data);
3170
+ break;
3171
+ }
3172
+ throw $e;
3173
+ }
3174
+ }
3175
+
3176
+ /**
3177
+ * Operation getContactStatsAsync
3178
+ *
3179
+ * Get the campaigns statistics for a contact
3180
+ *
3181
+ * @param string $email Email address (urlencoded) of the contact (required)
3182
+ *
3183
+ * @throws \InvalidArgumentException
3184
+ * @return \GuzzleHttp\Promise\PromiseInterface
3185
+ */
3186
+ public function getContactStatsAsync($email)
3187
+ {
3188
+ return $this->getContactStatsAsyncWithHttpInfo($email)
3189
+ ->then(
3190
+ function ($response) {
3191
+ return $response[0];
3192
+ }
3193
+ );
3194
+ }
3195
+
3196
+ /**
3197
+ * Operation getContactStatsAsyncWithHttpInfo
3198
+ *
3199
+ * Get the campaigns statistics for a contact
3200
+ *
3201
+ * @param string $email Email address (urlencoded) of the contact (required)
3202
+ *
3203
+ * @throws \InvalidArgumentException
3204
+ * @return \GuzzleHttp\Promise\PromiseInterface
3205
+ */
3206
+ public function getContactStatsAsyncWithHttpInfo($email)
3207
+ {
3208
+ $returnType = '\SendinBlue\Client\Model\GetContactCampaignStats';
3209
+ $request = $this->getContactStatsRequest($email);
3210
+
3211
+ return $this->client
3212
+ ->sendAsync($request, $this->createHttpClientOption())
3213
+ ->then(
3214
+ function ($response) use ($returnType) {
3215
+ $responseBody = $response->getBody();
3216
+ if ($returnType === '\SplFileObject') {
3217
+ $content = $responseBody; //stream goes to serializer
3218
+ } else {
3219
+ $content = $responseBody->getContents();
3220
+ if ($returnType !== 'string') {
3221
+ $content = json_decode($content);
3222
+ }
3223
+ }
3224
+
3225
+ return [
3226
+ ObjectSerializer::deserialize($content, $returnType, []),
3227
+ $response->getStatusCode(),
3228
+ $response->getHeaders()
3229
+ ];
3230
+ },
3231
+ function ($exception) {
3232
+ $response = $exception->getResponse();
3233
+ $statusCode = $response->getStatusCode();
3234
+ throw new ApiException(
3235
+ sprintf(
3236
+ '[%d] Error connecting to the API (%s)',
3237
+ $statusCode,
3238
+ $exception->getRequest()->getUri()
3239
+ ),
3240
+ $statusCode,
3241
+ $response->getHeaders(),
3242
+ $response->getBody()
3243
+ );
3244
+ }
3245
+ );
3246
+ }
3247
+
3248
+ /**
3249
+ * Create request for operation 'getContactStats'
3250
+ *
3251
+ * @param string $email Email address (urlencoded) of the contact (required)
3252
+ *
3253
+ * @throws \InvalidArgumentException
3254
+ * @return \GuzzleHttp\Psr7\Request
3255
+ */
3256
+ protected function getContactStatsRequest($email)
3257
+ {
3258
+ // verify the required parameter 'email' is set
3259
+ if ($email === null) {
3260
+ throw new \InvalidArgumentException(
3261
+ 'Missing the required parameter $email when calling getContactStats'
3262
+ );
3263
+ }
3264
+
3265
+ $resourcePath = '/contacts/{email}/campaignStats';
3266
+ $formParams = [];
3267
+ $queryParams = [];
3268
+ $headerParams = [];
3269
+ $httpBody = '';
3270
+ $multipart = false;
3271
+
3272
+
3273
+ // path params
3274
+ if ($email !== null) {
3275
+ $resourcePath = str_replace(
3276
+ '{' . 'email' . '}',
3277
+ ObjectSerializer::toPathValue($email),
3278
+ $resourcePath
3279
+ );
3280
+ }
3281
+
3282
+ // body params
3283
+ $_tempBody = null;
3284
+
3285
+ if ($multipart) {
3286
+ $headers = $this->headerSelector->selectHeadersForMultipart(
3287
+ ['application/json']
3288
+ );
3289
+ } else {
3290
+ $headers = $this->headerSelector->selectHeaders(
3291
+ ['application/json'],
3292
+ ['application/json']
3293
+ );
3294
+ }
3295
+
3296
+ // for model (json/xml)
3297
+ if (isset($_tempBody)) {
3298
+ // $_tempBody is the method argument, if present
3299
+ $httpBody = $_tempBody;
3300
+ // \stdClass has no __toString(), so we should encode it manually
3301
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
3302
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
3303
+ }
3304
+ } elseif (count($formParams) > 0) {
3305
+ if ($multipart) {
3306
+ $multipartContents = [];
3307
+ foreach ($formParams as $formParamName => $formParamValue) {
3308
+ $multipartContents[] = [
3309
+ 'name' => $formParamName,
3310
+ 'contents' => $formParamValue
3311
+ ];
3312
+ }
3313
+ // for HTTP post (form)
3314
+ $httpBody = new MultipartStream($multipartContents);
3315
+
3316
+ } elseif ($headers['Content-Type'] === 'application/json') {
3317
+ $httpBody = \GuzzleHttp\json_encode($formParams);
3318
+
3319
+ } else {
3320
+ // for HTTP post (form)
3321
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
3322
+ }
3323
+ }
3324
+
3325
+ // this endpoint requires API key authentication
3326
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
3327
+ if ($apiKey !== null) {
3328
+ $headers['api-key'] = $apiKey;
3329
+ }
3330
+ // this endpoint requires API key authentication
3331
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
3332
+ if ($apiKey !== null) {
3333
+ $headers['partner-key'] = $apiKey;
3334
+ }
3335
+
3336
+ $defaultHeaders = [];
3337
+ if ($this->config->getUserAgent()) {
3338
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
3339
+ }
3340
+
3341
+ $headers = array_merge(
3342
+ $defaultHeaders,
3343
+ $headerParams,
3344
+ $headers
3345
+ );
3346
+
3347
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
3348
+ return new Request(
3349
+ 'GET',
3350
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
3351
+ $headers,
3352
+ $httpBody
3353
+ );
3354
+ }
3355
+
3356
+ /**
3357
+ * Operation getContacts
3358
+ *
3359
+ * Get all the contacts
3360
+ *
3361
+ * @param int $limit Number of documents per page (optional, default to 50)
3362
+ * @param int $offset Index of the first document of the page (optional, default to 0)
3363
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
3364
+ *
3365
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3366
+ * @throws \InvalidArgumentException
3367
+ * @return \SendinBlue\Client\Model\GetContacts
3368
+ */
3369
+ public function getContacts($limit = '50', $offset = '0', $modifiedSince = null)
3370
+ {
3371
+ list($response) = $this->getContactsWithHttpInfo($limit, $offset, $modifiedSince);
3372
+ return $response;
3373
+ }
3374
+
3375
+ /**
3376
+ * Operation getContactsWithHttpInfo
3377
+ *
3378
+ * Get all the contacts
3379
+ *
3380
+ * @param int $limit Number of documents per page (optional, default to 50)
3381
+ * @param int $offset Index of the first document of the page (optional, default to 0)
3382
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
3383
+ *
3384
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3385
+ * @throws \InvalidArgumentException
3386
+ * @return array of \SendinBlue\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings)
3387
+ */
3388
+ public function getContactsWithHttpInfo($limit = '50', $offset = '0', $modifiedSince = null)
3389
+ {
3390
+ $returnType = '\SendinBlue\Client\Model\GetContacts';
3391
+ $request = $this->getContactsRequest($limit, $offset, $modifiedSince);
3392
+
3393
+ try {
3394
+ $options = $this->createHttpClientOption();
3395
+ try {
3396
+ $response = $this->client->send($request, $options);
3397
+ } catch (RequestException $e) {
3398
+ throw new ApiException(
3399
+ "[{$e->getCode()}] {$e->getMessage()}",
3400
+ $e->getCode(),
3401
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
3402
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
3403
+ );
3404
+ }
3405
+
3406
+ $statusCode = $response->getStatusCode();
3407
+
3408
+ if ($statusCode < 200 || $statusCode > 299) {
3409
+ throw new ApiException(
3410
+ sprintf(
3411
+ '[%d] Error connecting to the API (%s)',
3412
+ $statusCode,
3413
+ $request->getUri()
3414
+ ),
3415
+ $statusCode,
3416
+ $response->getHeaders(),
3417
+ $response->getBody()
3418
+ );
3419
+ }
3420
+
3421
+ $responseBody = $response->getBody();
3422
+ if ($returnType === '\SplFileObject') {
3423
+ $content = $responseBody; //stream goes to serializer
3424
+ } else {
3425
+ $content = $responseBody->getContents();
3426
+ if ($returnType !== 'string') {
3427
+ $content = json_decode($content);
3428
+ }
3429
+ }
3430
+
3431
+ return [
3432
+ ObjectSerializer::deserialize($content, $returnType, []),
3433
+ $response->getStatusCode(),
3434
+ $response->getHeaders()
3435
+ ];
3436
+
3437
+ } catch (ApiException $e) {
3438
+ switch ($e->getCode()) {
3439
+ case 200:
3440
+ $data = ObjectSerializer::deserialize(
3441
+ $e->getResponseBody(),
3442
+ '\SendinBlue\Client\Model\GetContacts',
3443
+ $e->getResponseHeaders()
3444
+ );
3445
+ $e->setResponseObject($data);
3446
+ break;
3447
+ case 400:
3448
+ $data = ObjectSerializer::deserialize(
3449
+ $e->getResponseBody(),
3450
+ '\SendinBlue\Client\Model\ErrorModel',
3451
+ $e->getResponseHeaders()
3452
+ );
3453
+ $e->setResponseObject($data);
3454
+ break;
3455
+ }
3456
+ throw $e;
3457
+ }
3458
+ }
3459
+
3460
+ /**
3461
+ * Operation getContactsAsync
3462
+ *
3463
+ * Get all the contacts
3464
+ *
3465
+ * @param int $limit Number of documents per page (optional, default to 50)
3466
+ * @param int $offset Index of the first document of the page (optional, default to 0)
3467
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
3468
+ *
3469
+ * @throws \InvalidArgumentException
3470
+ * @return \GuzzleHttp\Promise\PromiseInterface
3471
+ */
3472
+ public function getContactsAsync($limit = '50', $offset = '0', $modifiedSince = null)
3473
+ {
3474
+ return $this->getContactsAsyncWithHttpInfo($limit, $offset, $modifiedSince)
3475
+ ->then(
3476
+ function ($response) {
3477
+ return $response[0];
3478
+ }
3479
+ );
3480
+ }
3481
+
3482
+ /**
3483
+ * Operation getContactsAsyncWithHttpInfo
3484
+ *
3485
+ * Get all the contacts
3486
+ *
3487
+ * @param int $limit Number of documents per page (optional, default to 50)
3488
+ * @param int $offset Index of the first document of the page (optional, default to 0)
3489
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
3490
+ *
3491
+ * @throws \InvalidArgumentException
3492
+ * @return \GuzzleHttp\Promise\PromiseInterface
3493
+ */
3494
+ public function getContactsAsyncWithHttpInfo($limit = '50', $offset = '0', $modifiedSince = null)
3495
+ {
3496
+ $returnType = '\SendinBlue\Client\Model\GetContacts';
3497
+ $request = $this->getContactsRequest($limit, $offset, $modifiedSince);
3498
+
3499
+ return $this->client
3500
+ ->sendAsync($request, $this->createHttpClientOption())
3501
+ ->then(
3502
+ function ($response) use ($returnType) {
3503
+ $responseBody = $response->getBody();
3504
+ if ($returnType === '\SplFileObject') {
3505
+ $content = $responseBody; //stream goes to serializer
3506
+ } else {
3507
+ $content = $responseBody->getContents();
3508
+ if ($returnType !== 'string') {
3509
+ $content = json_decode($content);
3510
+ }
3511
+ }
3512
+
3513
+ return [
3514
+ ObjectSerializer::deserialize($content, $returnType, []),
3515
+ $response->getStatusCode(),
3516
+ $response->getHeaders()
3517
+ ];
3518
+ },
3519
+ function ($exception) {
3520
+ $response = $exception->getResponse();
3521
+ $statusCode = $response->getStatusCode();
3522
+ throw new ApiException(
3523
+ sprintf(
3524
+ '[%d] Error connecting to the API (%s)',
3525
+ $statusCode,
3526
+ $exception->getRequest()->getUri()
3527
+ ),
3528
+ $statusCode,
3529
+ $response->getHeaders(),
3530
+ $response->getBody()
3531
+ );
3532
+ }
3533
+ );
3534
+ }
3535
+
3536
+ /**
3537
+ * Create request for operation 'getContacts'
3538
+ *
3539
+ * @param int $limit Number of documents per page (optional, default to 50)
3540
+ * @param int $offset Index of the first document of the page (optional, default to 0)
3541
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
3542
+ *
3543
+ * @throws \InvalidArgumentException
3544
+ * @return \GuzzleHttp\Psr7\Request
3545
+ */
3546
+ protected function getContactsRequest($limit = '50', $offset = '0', $modifiedSince = null)
3547
+ {
3548
+ if ($limit !== null && $limit > 1000) {
3549
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContacts, must be smaller than or equal to 1000.');
3550
+ }
3551
+
3552
+
3553
+ $resourcePath = '/contacts';
3554
+ $formParams = [];
3555
+ $queryParams = [];
3556
+ $headerParams = [];
3557
+ $httpBody = '';
3558
+ $multipart = false;
3559
+
3560
+ // query params
3561
+ if ($limit !== null) {
3562
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
3563
+ }
3564
+ // query params
3565
+ if ($offset !== null) {
3566
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
3567
+ }
3568
+ // query params
3569
+ if ($modifiedSince !== null) {
3570
+ $queryParams['modifiedSince'] = ObjectSerializer::toQueryValue($modifiedSince);
3571
+ }
3572
+
3573
+
3574
+ // body params
3575
+ $_tempBody = null;
3576
+
3577
+ if ($multipart) {
3578
+ $headers = $this->headerSelector->selectHeadersForMultipart(
3579
+ ['application/json']
3580
+ );
3581
+ } else {
3582
+ $headers = $this->headerSelector->selectHeaders(
3583
+ ['application/json'],
3584
+ ['application/json']
3585
+ );
3586
+ }
3587
+
3588
+ // for model (json/xml)
3589
+ if (isset($_tempBody)) {
3590
+ // $_tempBody is the method argument, if present
3591
+ $httpBody = $_tempBody;
3592
+ // \stdClass has no __toString(), so we should encode it manually
3593
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
3594
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
3595
+ }
3596
+ } elseif (count($formParams) > 0) {
3597
+ if ($multipart) {
3598
+ $multipartContents = [];
3599
+ foreach ($formParams as $formParamName => $formParamValue) {
3600
+ $multipartContents[] = [
3601
+ 'name' => $formParamName,
3602
+ 'contents' => $formParamValue
3603
+ ];
3604
+ }
3605
+ // for HTTP post (form)
3606
+ $httpBody = new MultipartStream($multipartContents);
3607
+
3608
+ } elseif ($headers['Content-Type'] === 'application/json') {
3609
+ $httpBody = \GuzzleHttp\json_encode($formParams);
3610
+
3611
+ } else {
3612
+ // for HTTP post (form)
3613
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
3614
+ }
3615
+ }
3616
+
3617
+ // this endpoint requires API key authentication
3618
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
3619
+ if ($apiKey !== null) {
3620
+ $headers['api-key'] = $apiKey;
3621
+ }
3622
+ // this endpoint requires API key authentication
3623
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
3624
+ if ($apiKey !== null) {
3625
+ $headers['partner-key'] = $apiKey;
3626
+ }
3627
+
3628
+ $defaultHeaders = [];
3629
+ if ($this->config->getUserAgent()) {
3630
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
3631
+ }
3632
+
3633
+ $headers = array_merge(
3634
+ $defaultHeaders,
3635
+ $headerParams,
3636
+ $headers
3637
+ );
3638
+
3639
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
3640
+ return new Request(
3641
+ 'GET',
3642
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
3643
+ $headers,
3644
+ $httpBody
3645
+ );
3646
+ }
3647
+
3648
+ /**
3649
+ * Operation getContactsFromList
3650
+ *
3651
+ * Get the contacts in a list
3652
+ *
3653
+ * @param int $listId Id of the list (required)
3654
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
3655
+ * @param int $limit Number of documents per page (optional, default to 50)
3656
+ * @param int $offset Index of the first document of the page (optional, default to 0)
3657
+ *
3658
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3659
+ * @throws \InvalidArgumentException
3660
+ * @return \SendinBlue\Client\Model\GetContacts
3661
+ */
3662
+ public function getContactsFromList($listId, $modifiedSince = null, $limit = '50', $offset = '0')
3663
+ {
3664
+ list($response) = $this->getContactsFromListWithHttpInfo($listId, $modifiedSince, $limit, $offset);
3665
+ return $response;
3666
+ }
3667
+
3668
+ /**
3669
+ * Operation getContactsFromListWithHttpInfo
3670
+ *
3671
+ * Get the contacts in a list
3672
+ *
3673
+ * @param int $listId Id of the list (required)
3674
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
3675
+ * @param int $limit Number of documents per page (optional, default to 50)
3676
+ * @param int $offset Index of the first document of the page (optional, default to 0)
3677
+ *
3678
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3679
+ * @throws \InvalidArgumentException
3680
+ * @return array of \SendinBlue\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings)
3681
+ */
3682
+ public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0')
3683
+ {
3684
+ $returnType = '\SendinBlue\Client\Model\GetContacts';
3685
+ $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset);
3686
+
3687
+ try {
3688
+ $options = $this->createHttpClientOption();
3689
+ try {
3690
+ $response = $this->client->send($request, $options);
3691
+ } catch (RequestException $e) {
3692
+ throw new ApiException(
3693
+ "[{$e->getCode()}] {$e->getMessage()}",
3694
+ $e->getCode(),
3695
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
3696
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
3697
+ );
3698
+ }
3699
+
3700
+ $statusCode = $response->getStatusCode();
3701
+
3702
+ if ($statusCode < 200 || $statusCode > 299) {
3703
+ throw new ApiException(
3704
+ sprintf(
3705
+ '[%d] Error connecting to the API (%s)',
3706
+ $statusCode,
3707
+ $request->getUri()
3708
+ ),
3709
+ $statusCode,
3710
+ $response->getHeaders(),
3711
+ $response->getBody()
3712
+ );
3713
+ }
3714
+
3715
+ $responseBody = $response->getBody();
3716
+ if ($returnType === '\SplFileObject') {
3717
+ $content = $responseBody; //stream goes to serializer
3718
+ } else {
3719
+ $content = $responseBody->getContents();
3720
+ if ($returnType !== 'string') {
3721
+ $content = json_decode($content);
3722
+ }
3723
+ }
3724
+
3725
+ return [
3726
+ ObjectSerializer::deserialize($content, $returnType, []),
3727
+ $response->getStatusCode(),
3728
+ $response->getHeaders()
3729
+ ];
3730
+
3731
+ } catch (ApiException $e) {
3732
+ switch ($e->getCode()) {
3733
+ case 200:
3734
+ $data = ObjectSerializer::deserialize(
3735
+ $e->getResponseBody(),
3736
+ '\SendinBlue\Client\Model\GetContacts',
3737
+ $e->getResponseHeaders()
3738
+ );
3739
+ $e->setResponseObject($data);
3740
+ break;
3741
+ case 400:
3742
+ $data = ObjectSerializer::deserialize(
3743
+ $e->getResponseBody(),
3744
+ '\SendinBlue\Client\Model\ErrorModel',
3745
+ $e->getResponseHeaders()
3746
+ );
3747
+ $e->setResponseObject($data);
3748
+ break;
3749
+ case 404:
3750
+ $data = ObjectSerializer::deserialize(
3751
+ $e->getResponseBody(),
3752
+ '\SendinBlue\Client\Model\ErrorModel',
3753
+ $e->getResponseHeaders()
3754
+ );
3755
+ $e->setResponseObject($data);
3756
+ break;
3757
+ }
3758
+ throw $e;
3759
+ }
3760
+ }
3761
+
3762
+ /**
3763
+ * Operation getContactsFromListAsync
3764
+ *
3765
+ * Get the contacts in a list
3766
+ *
3767
+ * @param int $listId Id of the list (required)
3768
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
3769
+ * @param int $limit Number of documents per page (optional, default to 50)
3770
+ * @param int $offset Index of the first document of the page (optional, default to 0)
3771
+ *
3772
+ * @throws \InvalidArgumentException
3773
+ * @return \GuzzleHttp\Promise\PromiseInterface
3774
+ */
3775
+ public function getContactsFromListAsync($listId, $modifiedSince = null, $limit = '50', $offset = '0')
3776
+ {
3777
+ return $this->getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince, $limit, $offset)
3778
+ ->then(
3779
+ function ($response) {
3780
+ return $response[0];
3781
+ }
3782
+ );
3783
+ }
3784
+
3785
+ /**
3786
+ * Operation getContactsFromListAsyncWithHttpInfo
3787
+ *
3788
+ * Get the contacts in a list
3789
+ *
3790
+ * @param int $listId Id of the list (required)
3791
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
3792
+ * @param int $limit Number of documents per page (optional, default to 50)
3793
+ * @param int $offset Index of the first document of the page (optional, default to 0)
3794
+ *
3795
+ * @throws \InvalidArgumentException
3796
+ * @return \GuzzleHttp\Promise\PromiseInterface
3797
+ */
3798
+ public function getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0')
3799
+ {
3800
+ $returnType = '\SendinBlue\Client\Model\GetContacts';
3801
+ $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset);
3802
+
3803
+ return $this->client
3804
+ ->sendAsync($request, $this->createHttpClientOption())
3805
+ ->then(
3806
+ function ($response) use ($returnType) {
3807
+ $responseBody = $response->getBody();
3808
+ if ($returnType === '\SplFileObject') {
3809
+ $content = $responseBody; //stream goes to serializer
3810
+ } else {
3811
+ $content = $responseBody->getContents();
3812
+ if ($returnType !== 'string') {
3813
+ $content = json_decode($content);
3814
+ }
3815
+ }
3816
+
3817
+ return [
3818
+ ObjectSerializer::deserialize($content, $returnType, []),
3819
+ $response->getStatusCode(),
3820
+ $response->getHeaders()
3821
+ ];
3822
+ },
3823
+ function ($exception) {
3824
+ $response = $exception->getResponse();
3825
+ $statusCode = $response->getStatusCode();
3826
+ throw new ApiException(
3827
+ sprintf(
3828
+ '[%d] Error connecting to the API (%s)',
3829
+ $statusCode,
3830
+ $exception->getRequest()->getUri()
3831
+ ),
3832
+ $statusCode,
3833
+ $response->getHeaders(),
3834
+ $response->getBody()
3835
+ );
3836
+ }
3837
+ );
3838
+ }
3839
+
3840
+ /**
3841
+ * Create request for operation 'getContactsFromList'
3842
+ *
3843
+ * @param int $listId Id of the list (required)
3844
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
3845
+ * @param int $limit Number of documents per page (optional, default to 50)
3846
+ * @param int $offset Index of the first document of the page (optional, default to 0)
3847
+ *
3848
+ * @throws \InvalidArgumentException
3849
+ * @return \GuzzleHttp\Psr7\Request
3850
+ */
3851
+ protected function getContactsFromListRequest($listId, $modifiedSince = null, $limit = '50', $offset = '0')
3852
+ {
3853
+ // verify the required parameter 'listId' is set
3854
+ if ($listId === null) {
3855
+ throw new \InvalidArgumentException(
3856
+ 'Missing the required parameter $listId when calling getContactsFromList'
3857
+ );
3858
+ }
3859
+ if ($limit !== null && $limit > 500) {
3860
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContactsFromList, must be smaller than or equal to 500.');
3861
+ }
3862
+
3863
+
3864
+ $resourcePath = '/contacts/lists/{listId}/contacts';
3865
+ $formParams = [];
3866
+ $queryParams = [];
3867
+ $headerParams = [];
3868
+ $httpBody = '';
3869
+ $multipart = false;
3870
+
3871
+ // query params
3872
+ if ($modifiedSince !== null) {
3873
+ $queryParams['modifiedSince'] = ObjectSerializer::toQueryValue($modifiedSince);
3874
+ }
3875
+ // query params
3876
+ if ($limit !== null) {
3877
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
3878
+ }
3879
+ // query params
3880
+ if ($offset !== null) {
3881
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
3882
+ }
3883
+
3884
+ // path params
3885
+ if ($listId !== null) {
3886
+ $resourcePath = str_replace(
3887
+ '{' . 'listId' . '}',
3888
+ ObjectSerializer::toPathValue($listId),
3889
+ $resourcePath
3890
+ );
3891
+ }
3892
+
3893
+ // body params
3894
+ $_tempBody = null;
3895
+
3896
+ if ($multipart) {
3897
+ $headers = $this->headerSelector->selectHeadersForMultipart(
3898
+ ['application/json']
3899
+ );
3900
+ } else {
3901
+ $headers = $this->headerSelector->selectHeaders(
3902
+ ['application/json'],
3903
+ ['application/json']
3904
+ );
3905
+ }
3906
+
3907
+ // for model (json/xml)
3908
+ if (isset($_tempBody)) {
3909
+ // $_tempBody is the method argument, if present
3910
+ $httpBody = $_tempBody;
3911
+ // \stdClass has no __toString(), so we should encode it manually
3912
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
3913
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
3914
+ }
3915
+ } elseif (count($formParams) > 0) {
3916
+ if ($multipart) {
3917
+ $multipartContents = [];
3918
+ foreach ($formParams as $formParamName => $formParamValue) {
3919
+ $multipartContents[] = [
3920
+ 'name' => $formParamName,
3921
+ 'contents' => $formParamValue
3922
+ ];
3923
+ }
3924
+ // for HTTP post (form)
3925
+ $httpBody = new MultipartStream($multipartContents);
3926
+
3927
+ } elseif ($headers['Content-Type'] === 'application/json') {
3928
+ $httpBody = \GuzzleHttp\json_encode($formParams);
3929
+
3930
+ } else {
3931
+ // for HTTP post (form)
3932
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
3933
+ }
3934
+ }
3935
+
3936
+ // this endpoint requires API key authentication
3937
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
3938
+ if ($apiKey !== null) {
3939
+ $headers['api-key'] = $apiKey;
3940
+ }
3941
+ // this endpoint requires API key authentication
3942
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
3943
+ if ($apiKey !== null) {
3944
+ $headers['partner-key'] = $apiKey;
3945
+ }
3946
+
3947
+ $defaultHeaders = [];
3948
+ if ($this->config->getUserAgent()) {
3949
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
3950
+ }
3951
+
3952
+ $headers = array_merge(
3953
+ $defaultHeaders,
3954
+ $headerParams,
3955
+ $headers
3956
+ );
3957
+
3958
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
3959
+ return new Request(
3960
+ 'GET',
3961
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
3962
+ $headers,
3963
+ $httpBody
3964
+ );
3965
+ }
3966
+
3967
+ /**
3968
+ * Operation getFolder
3969
+ *
3970
+ * Returns folder details
3971
+ *
3972
+ * @param int $folderId id of the folder (required)
3973
+ *
3974
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3975
+ * @throws \InvalidArgumentException
3976
+ * @return \SendinBlue\Client\Model\GetFolder
3977
+ */
3978
+ public function getFolder($folderId)
3979
+ {
3980
+ list($response) = $this->getFolderWithHttpInfo($folderId);
3981
+ return $response;
3982
+ }
3983
+
3984
+ /**
3985
+ * Operation getFolderWithHttpInfo
3986
+ *
3987
+ * Returns folder details
3988
+ *
3989
+ * @param int $folderId id of the folder (required)
3990
+ *
3991
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3992
+ * @throws \InvalidArgumentException
3993
+ * @return array of \SendinBlue\Client\Model\GetFolder, HTTP status code, HTTP response headers (array of strings)
3994
+ */
3995
+ public function getFolderWithHttpInfo($folderId)
3996
+ {
3997
+ $returnType = '\SendinBlue\Client\Model\GetFolder';
3998
+ $request = $this->getFolderRequest($folderId);
3999
+
4000
+ try {
4001
+ $options = $this->createHttpClientOption();
4002
+ try {
4003
+ $response = $this->client->send($request, $options);
4004
+ } catch (RequestException $e) {
4005
+ throw new ApiException(
4006
+ "[{$e->getCode()}] {$e->getMessage()}",
4007
+ $e->getCode(),
4008
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
4009
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
4010
+ );
4011
+ }
4012
+
4013
+ $statusCode = $response->getStatusCode();
4014
+
4015
+ if ($statusCode < 200 || $statusCode > 299) {
4016
+ throw new ApiException(
4017
+ sprintf(
4018
+ '[%d] Error connecting to the API (%s)',
4019
+ $statusCode,
4020
+ $request->getUri()
4021
+ ),
4022
+ $statusCode,
4023
+ $response->getHeaders(),
4024
+ $response->getBody()
4025
+ );
4026
+ }
4027
+
4028
+ $responseBody = $response->getBody();
4029
+ if ($returnType === '\SplFileObject') {
4030
+ $content = $responseBody; //stream goes to serializer
4031
+ } else {
4032
+ $content = $responseBody->getContents();
4033
+ if ($returnType !== 'string') {
4034
+ $content = json_decode($content);
4035
+ }
4036
+ }
4037
+
4038
+ return [
4039
+ ObjectSerializer::deserialize($content, $returnType, []),
4040
+ $response->getStatusCode(),
4041
+ $response->getHeaders()
4042
+ ];
4043
+
4044
+ } catch (ApiException $e) {
4045
+ switch ($e->getCode()) {
4046
+ case 200:
4047
+ $data = ObjectSerializer::deserialize(
4048
+ $e->getResponseBody(),
4049
+ '\SendinBlue\Client\Model\GetFolder',
4050
+ $e->getResponseHeaders()
4051
+ );
4052
+ $e->setResponseObject($data);
4053
+ break;
4054
+ case 400:
4055
+ $data = ObjectSerializer::deserialize(
4056
+ $e->getResponseBody(),
4057
+ '\SendinBlue\Client\Model\ErrorModel',
4058
+ $e->getResponseHeaders()
4059
+ );
4060
+ $e->setResponseObject($data);
4061
+ break;
4062
+ case 404:
4063
+ $data = ObjectSerializer::deserialize(
4064
+ $e->getResponseBody(),
4065
+ '\SendinBlue\Client\Model\ErrorModel',
4066
+ $e->getResponseHeaders()
4067
+ );
4068
+ $e->setResponseObject($data);
4069
+ break;
4070
+ }
4071
+ throw $e;
4072
+ }
4073
+ }
4074
+
4075
+ /**
4076
+ * Operation getFolderAsync
4077
+ *
4078
+ * Returns folder details
4079
+ *
4080
+ * @param int $folderId id of the folder (required)
4081
+ *
4082
+ * @throws \InvalidArgumentException
4083
+ * @return \GuzzleHttp\Promise\PromiseInterface
4084
+ */
4085
+ public function getFolderAsync($folderId)
4086
+ {
4087
+ return $this->getFolderAsyncWithHttpInfo($folderId)
4088
+ ->then(
4089
+ function ($response) {
4090
+ return $response[0];
4091
+ }
4092
+ );
4093
+ }
4094
+
4095
+ /**
4096
+ * Operation getFolderAsyncWithHttpInfo
4097
+ *
4098
+ * Returns folder details
4099
+ *
4100
+ * @param int $folderId id of the folder (required)
4101
+ *
4102
+ * @throws \InvalidArgumentException
4103
+ * @return \GuzzleHttp\Promise\PromiseInterface
4104
+ */
4105
+ public function getFolderAsyncWithHttpInfo($folderId)
4106
+ {
4107
+ $returnType = '\SendinBlue\Client\Model\GetFolder';
4108
+ $request = $this->getFolderRequest($folderId);
4109
+
4110
+ return $this->client
4111
+ ->sendAsync($request, $this->createHttpClientOption())
4112
+ ->then(
4113
+ function ($response) use ($returnType) {
4114
+ $responseBody = $response->getBody();
4115
+ if ($returnType === '\SplFileObject') {
4116
+ $content = $responseBody; //stream goes to serializer
4117
+ } else {
4118
+ $content = $responseBody->getContents();
4119
+ if ($returnType !== 'string') {
4120
+ $content = json_decode($content);
4121
+ }
4122
+ }
4123
+
4124
+ return [
4125
+ ObjectSerializer::deserialize($content, $returnType, []),
4126
+ $response->getStatusCode(),
4127
+ $response->getHeaders()
4128
+ ];
4129
+ },
4130
+ function ($exception) {
4131
+ $response = $exception->getResponse();
4132
+ $statusCode = $response->getStatusCode();
4133
+ throw new ApiException(
4134
+ sprintf(
4135
+ '[%d] Error connecting to the API (%s)',
4136
+ $statusCode,
4137
+ $exception->getRequest()->getUri()
4138
+ ),
4139
+ $statusCode,
4140
+ $response->getHeaders(),
4141
+ $response->getBody()
4142
+ );
4143
+ }
4144
+ );
4145
+ }
4146
+
4147
+ /**
4148
+ * Create request for operation 'getFolder'
4149
+ *
4150
+ * @param int $folderId id of the folder (required)
4151
+ *
4152
+ * @throws \InvalidArgumentException
4153
+ * @return \GuzzleHttp\Psr7\Request
4154
+ */
4155
+ protected function getFolderRequest($folderId)
4156
+ {
4157
+ // verify the required parameter 'folderId' is set
4158
+ if ($folderId === null) {
4159
+ throw new \InvalidArgumentException(
4160
+ 'Missing the required parameter $folderId when calling getFolder'
4161
+ );
4162
+ }
4163
+
4164
+ $resourcePath = '/contacts/folders/{folderId}';
4165
+ $formParams = [];
4166
+ $queryParams = [];
4167
+ $headerParams = [];
4168
+ $httpBody = '';
4169
+ $multipart = false;
4170
+
4171
+
4172
+ // path params
4173
+ if ($folderId !== null) {
4174
+ $resourcePath = str_replace(
4175
+ '{' . 'folderId' . '}',
4176
+ ObjectSerializer::toPathValue($folderId),
4177
+ $resourcePath
4178
+ );
4179
+ }
4180
+
4181
+ // body params
4182
+ $_tempBody = null;
4183
+
4184
+ if ($multipart) {
4185
+ $headers = $this->headerSelector->selectHeadersForMultipart(
4186
+ ['application/json']
4187
+ );
4188
+ } else {
4189
+ $headers = $this->headerSelector->selectHeaders(
4190
+ ['application/json'],
4191
+ ['application/json']
4192
+ );
4193
+ }
4194
+
4195
+ // for model (json/xml)
4196
+ if (isset($_tempBody)) {
4197
+ // $_tempBody is the method argument, if present
4198
+ $httpBody = $_tempBody;
4199
+ // \stdClass has no __toString(), so we should encode it manually
4200
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
4201
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
4202
+ }
4203
+ } elseif (count($formParams) > 0) {
4204
+ if ($multipart) {
4205
+ $multipartContents = [];
4206
+ foreach ($formParams as $formParamName => $formParamValue) {
4207
+ $multipartContents[] = [
4208
+ 'name' => $formParamName,
4209
+ 'contents' => $formParamValue
4210
+ ];
4211
+ }
4212
+ // for HTTP post (form)
4213
+ $httpBody = new MultipartStream($multipartContents);
4214
+
4215
+ } elseif ($headers['Content-Type'] === 'application/json') {
4216
+ $httpBody = \GuzzleHttp\json_encode($formParams);
4217
+
4218
+ } else {
4219
+ // for HTTP post (form)
4220
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
4221
+ }
4222
+ }
4223
+
4224
+ // this endpoint requires API key authentication
4225
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
4226
+ if ($apiKey !== null) {
4227
+ $headers['api-key'] = $apiKey;
4228
+ }
4229
+ // this endpoint requires API key authentication
4230
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
4231
+ if ($apiKey !== null) {
4232
+ $headers['partner-key'] = $apiKey;
4233
+ }
4234
+
4235
+ $defaultHeaders = [];
4236
+ if ($this->config->getUserAgent()) {
4237
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
4238
+ }
4239
+
4240
+ $headers = array_merge(
4241
+ $defaultHeaders,
4242
+ $headerParams,
4243
+ $headers
4244
+ );
4245
+
4246
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
4247
+ return new Request(
4248
+ 'GET',
4249
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
4250
+ $headers,
4251
+ $httpBody
4252
+ );
4253
+ }
4254
+
4255
+ /**
4256
+ * Operation getFolderLists
4257
+ *
4258
+ * Get the lists in a folder
4259
+ *
4260
+ * @param int $folderId Id of the folder (required)
4261
+ * @param int $limit Number of documents per page (optional, default to 10)
4262
+ * @param int $offset Index of the first document of the page (optional, default to 0)
4263
+ *
4264
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
4265
+ * @throws \InvalidArgumentException
4266
+ * @return \SendinBlue\Client\Model\GetFolderLists
4267
+ */
4268
+ public function getFolderLists($folderId, $limit = '10', $offset = '0')
4269
+ {
4270
+ list($response) = $this->getFolderListsWithHttpInfo($folderId, $limit, $offset);
4271
+ return $response;
4272
+ }
4273
+
4274
+ /**
4275
+ * Operation getFolderListsWithHttpInfo
4276
+ *
4277
+ * Get the lists in a folder
4278
+ *
4279
+ * @param int $folderId Id of the folder (required)
4280
+ * @param int $limit Number of documents per page (optional, default to 10)
4281
+ * @param int $offset Index of the first document of the page (optional, default to 0)
4282
+ *
4283
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
4284
+ * @throws \InvalidArgumentException
4285
+ * @return array of \SendinBlue\Client\Model\GetFolderLists, HTTP status code, HTTP response headers (array of strings)
4286
+ */
4287
+ public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = '0')
4288
+ {
4289
+ $returnType = '\SendinBlue\Client\Model\GetFolderLists';
4290
+ $request = $this->getFolderListsRequest($folderId, $limit, $offset);
4291
+
4292
+ try {
4293
+ $options = $this->createHttpClientOption();
4294
+ try {
4295
+ $response = $this->client->send($request, $options);
4296
+ } catch (RequestException $e) {
4297
+ throw new ApiException(
4298
+ "[{$e->getCode()}] {$e->getMessage()}",
4299
+ $e->getCode(),
4300
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
4301
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
4302
+ );
4303
+ }
4304
+
4305
+ $statusCode = $response->getStatusCode();
4306
+
4307
+ if ($statusCode < 200 || $statusCode > 299) {
4308
+ throw new ApiException(
4309
+ sprintf(
4310
+ '[%d] Error connecting to the API (%s)',
4311
+ $statusCode,
4312
+ $request->getUri()
4313
+ ),
4314
+ $statusCode,
4315
+ $response->getHeaders(),
4316
+ $response->getBody()
4317
+ );
4318
+ }
4319
+
4320
+ $responseBody = $response->getBody();
4321
+ if ($returnType === '\SplFileObject') {
4322
+ $content = $responseBody; //stream goes to serializer
4323
+ } else {
4324
+ $content = $responseBody->getContents();
4325
+ if ($returnType !== 'string') {
4326
+ $content = json_decode($content);
4327
+ }
4328
+ }
4329
+
4330
+ return [
4331
+ ObjectSerializer::deserialize($content, $returnType, []),
4332
+ $response->getStatusCode(),
4333
+ $response->getHeaders()
4334
+ ];
4335
+
4336
+ } catch (ApiException $e) {
4337
+ switch ($e->getCode()) {
4338
+ case 200:
4339
+ $data = ObjectSerializer::deserialize(
4340
+ $e->getResponseBody(),
4341
+ '\SendinBlue\Client\Model\GetFolderLists',
4342
+ $e->getResponseHeaders()
4343
+ );
4344
+ $e->setResponseObject($data);
4345
+ break;
4346
+ case 400:
4347
+ $data = ObjectSerializer::deserialize(
4348
+ $e->getResponseBody(),
4349
+ '\SendinBlue\Client\Model\ErrorModel',
4350
+ $e->getResponseHeaders()
4351
+ );
4352
+ $e->setResponseObject($data);
4353
+ break;
4354
+ case 404:
4355
+ $data = ObjectSerializer::deserialize(
4356
+ $e->getResponseBody(),
4357
+ '\SendinBlue\Client\Model\ErrorModel',
4358
+ $e->getResponseHeaders()
4359
+ );
4360
+ $e->setResponseObject($data);
4361
+ break;
4362
+ }
4363
+ throw $e;
4364
+ }
4365
+ }
4366
+
4367
+ /**
4368
+ * Operation getFolderListsAsync
4369
+ *
4370
+ * Get the lists in a folder
4371
+ *
4372
+ * @param int $folderId Id of the folder (required)
4373
+ * @param int $limit Number of documents per page (optional, default to 10)
4374
+ * @param int $offset Index of the first document of the page (optional, default to 0)
4375
+ *
4376
+ * @throws \InvalidArgumentException
4377
+ * @return \GuzzleHttp\Promise\PromiseInterface
4378
+ */
4379
+ public function getFolderListsAsync($folderId, $limit = '10', $offset = '0')
4380
+ {
4381
+ return $this->getFolderListsAsyncWithHttpInfo($folderId, $limit, $offset)
4382
+ ->then(
4383
+ function ($response) {
4384
+ return $response[0];
4385
+ }
4386
+ );
4387
+ }
4388
+
4389
+ /**
4390
+ * Operation getFolderListsAsyncWithHttpInfo
4391
+ *
4392
+ * Get the lists in a folder
4393
+ *
4394
+ * @param int $folderId Id of the folder (required)
4395
+ * @param int $limit Number of documents per page (optional, default to 10)
4396
+ * @param int $offset Index of the first document of the page (optional, default to 0)
4397
+ *
4398
+ * @throws \InvalidArgumentException
4399
+ * @return \GuzzleHttp\Promise\PromiseInterface
4400
+ */
4401
+ public function getFolderListsAsyncWithHttpInfo($folderId, $limit = '10', $offset = '0')
4402
+ {
4403
+ $returnType = '\SendinBlue\Client\Model\GetFolderLists';
4404
+ $request = $this->getFolderListsRequest($folderId, $limit, $offset);
4405
+
4406
+ return $this->client
4407
+ ->sendAsync($request, $this->createHttpClientOption())
4408
+ ->then(
4409
+ function ($response) use ($returnType) {
4410
+ $responseBody = $response->getBody();
4411
+ if ($returnType === '\SplFileObject') {
4412
+ $content = $responseBody; //stream goes to serializer
4413
+ } else {
4414
+ $content = $responseBody->getContents();
4415
+ if ($returnType !== 'string') {
4416
+ $content = json_decode($content);
4417
+ }
4418
+ }
4419
+
4420
+ return [
4421
+ ObjectSerializer::deserialize($content, $returnType, []),
4422
+ $response->getStatusCode(),
4423
+ $response->getHeaders()
4424
+ ];
4425
+ },
4426
+ function ($exception) {
4427
+ $response = $exception->getResponse();
4428
+ $statusCode = $response->getStatusCode();
4429
+ throw new ApiException(
4430
+ sprintf(
4431
+ '[%d] Error connecting to the API (%s)',
4432
+ $statusCode,
4433
+ $exception->getRequest()->getUri()
4434
+ ),
4435
+ $statusCode,
4436
+ $response->getHeaders(),
4437
+ $response->getBody()
4438
+ );
4439
+ }
4440
+ );
4441
+ }
4442
+
4443
+ /**
4444
+ * Create request for operation 'getFolderLists'
4445
+ *
4446
+ * @param int $folderId Id of the folder (required)
4447
+ * @param int $limit Number of documents per page (optional, default to 10)
4448
+ * @param int $offset Index of the first document of the page (optional, default to 0)
4449
+ *
4450
+ * @throws \InvalidArgumentException
4451
+ * @return \GuzzleHttp\Psr7\Request
4452
+ */
4453
+ protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0')
4454
+ {
4455
+ // verify the required parameter 'folderId' is set
4456
+ if ($folderId === null) {
4457
+ throw new \InvalidArgumentException(
4458
+ 'Missing the required parameter $folderId when calling getFolderLists'
4459
+ );
4460
+ }
4461
+ if ($limit !== null && $limit > 50) {
4462
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolderLists, must be smaller than or equal to 50.');
4463
+ }
4464
+
4465
+
4466
+ $resourcePath = '/contacts/folders/{folderId}/lists';
4467
+ $formParams = [];
4468
+ $queryParams = [];
4469
+ $headerParams = [];
4470
+ $httpBody = '';
4471
+ $multipart = false;
4472
+
4473
+ // query params
4474
+ if ($limit !== null) {
4475
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
4476
+ }
4477
+ // query params
4478
+ if ($offset !== null) {
4479
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
4480
+ }
4481
+
4482
+ // path params
4483
+ if ($folderId !== null) {
4484
+ $resourcePath = str_replace(
4485
+ '{' . 'folderId' . '}',
4486
+ ObjectSerializer::toPathValue($folderId),
4487
+ $resourcePath
4488
+ );
4489
+ }
4490
+
4491
+ // body params
4492
+ $_tempBody = null;
4493
+
4494
+ if ($multipart) {
4495
+ $headers = $this->headerSelector->selectHeadersForMultipart(
4496
+ ['application/json']
4497
+ );
4498
+ } else {
4499
+ $headers = $this->headerSelector->selectHeaders(
4500
+ ['application/json'],
4501
+ ['application/json']
4502
+ );
4503
+ }
4504
+
4505
+ // for model (json/xml)
4506
+ if (isset($_tempBody)) {
4507
+ // $_tempBody is the method argument, if present
4508
+ $httpBody = $_tempBody;
4509
+ // \stdClass has no __toString(), so we should encode it manually
4510
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
4511
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
4512
+ }
4513
+ } elseif (count($formParams) > 0) {
4514
+ if ($multipart) {
4515
+ $multipartContents = [];
4516
+ foreach ($formParams as $formParamName => $formParamValue) {
4517
+ $multipartContents[] = [
4518
+ 'name' => $formParamName,
4519
+ 'contents' => $formParamValue
4520
+ ];
4521
+ }
4522
+ // for HTTP post (form)
4523
+ $httpBody = new MultipartStream($multipartContents);
4524
+
4525
+ } elseif ($headers['Content-Type'] === 'application/json') {
4526
+ $httpBody = \GuzzleHttp\json_encode($formParams);
4527
+
4528
+ } else {
4529
+ // for HTTP post (form)
4530
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
4531
+ }
4532
+ }
4533
+
4534
+ // this endpoint requires API key authentication
4535
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
4536
+ if ($apiKey !== null) {
4537
+ $headers['api-key'] = $apiKey;
4538
+ }
4539
+ // this endpoint requires API key authentication
4540
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
4541
+ if ($apiKey !== null) {
4542
+ $headers['partner-key'] = $apiKey;
4543
+ }
4544
+
4545
+ $defaultHeaders = [];
4546
+ if ($this->config->getUserAgent()) {
4547
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
4548
+ }
4549
+
4550
+ $headers = array_merge(
4551
+ $defaultHeaders,
4552
+ $headerParams,
4553
+ $headers
4554
+ );
4555
+
4556
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
4557
+ return new Request(
4558
+ 'GET',
4559
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
4560
+ $headers,
4561
+ $httpBody
4562
+ );
4563
+ }
4564
+
4565
+ /**
4566
+ * Operation getFolders
4567
+ *
4568
+ * Get all the folders
4569
+ *
4570
+ * @param int $limit Number of documents per page (required)
4571
+ * @param int $offset Index of the first document of the page (required)
4572
+ *
4573
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
4574
+ * @throws \InvalidArgumentException
4575
+ * @return \SendinBlue\Client\Model\GetFolders
4576
+ */
4577
+ public function getFolders($limit, $offset)
4578
+ {
4579
+ list($response) = $this->getFoldersWithHttpInfo($limit, $offset);
4580
+ return $response;
4581
+ }
4582
+
4583
+ /**
4584
+ * Operation getFoldersWithHttpInfo
4585
+ *
4586
+ * Get all the folders
4587
+ *
4588
+ * @param int $limit Number of documents per page (required)
4589
+ * @param int $offset Index of the first document of the page (required)
4590
+ *
4591
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
4592
+ * @throws \InvalidArgumentException
4593
+ * @return array of \SendinBlue\Client\Model\GetFolders, HTTP status code, HTTP response headers (array of strings)
4594
+ */
4595
+ public function getFoldersWithHttpInfo($limit, $offset)
4596
+ {
4597
+ $returnType = '\SendinBlue\Client\Model\GetFolders';
4598
+ $request = $this->getFoldersRequest($limit, $offset);
4599
+
4600
+ try {
4601
+ $options = $this->createHttpClientOption();
4602
+ try {
4603
+ $response = $this->client->send($request, $options);
4604
+ } catch (RequestException $e) {
4605
+ throw new ApiException(
4606
+ "[{$e->getCode()}] {$e->getMessage()}",
4607
+ $e->getCode(),
4608
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
4609
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
4610
+ );
4611
+ }
4612
+
4613
+ $statusCode = $response->getStatusCode();
4614
+
4615
+ if ($statusCode < 200 || $statusCode > 299) {
4616
+ throw new ApiException(
4617
+ sprintf(
4618
+ '[%d] Error connecting to the API (%s)',
4619
+ $statusCode,
4620
+ $request->getUri()
4621
+ ),
4622
+ $statusCode,
4623
+ $response->getHeaders(),
4624
+ $response->getBody()
4625
+ );
4626
+ }
4627
+
4628
+ $responseBody = $response->getBody();
4629
+ if ($returnType === '\SplFileObject') {
4630
+ $content = $responseBody; //stream goes to serializer
4631
+ } else {
4632
+ $content = $responseBody->getContents();
4633
+ if ($returnType !== 'string') {
4634
+ $content = json_decode($content);
4635
+ }
4636
+ }
4637
+
4638
+ return [
4639
+ ObjectSerializer::deserialize($content, $returnType, []),
4640
+ $response->getStatusCode(),
4641
+ $response->getHeaders()
4642
+ ];
4643
+
4644
+ } catch (ApiException $e) {
4645
+ switch ($e->getCode()) {
4646
+ case 200:
4647
+ $data = ObjectSerializer::deserialize(
4648
+ $e->getResponseBody(),
4649
+ '\SendinBlue\Client\Model\GetFolders',
4650
+ $e->getResponseHeaders()
4651
+ );
4652
+ $e->setResponseObject($data);
4653
+ break;
4654
+ case 400:
4655
+ $data = ObjectSerializer::deserialize(
4656
+ $e->getResponseBody(),
4657
+ '\SendinBlue\Client\Model\ErrorModel',
4658
+ $e->getResponseHeaders()
4659
+ );
4660
+ $e->setResponseObject($data);
4661
+ break;
4662
+ }
4663
+ throw $e;
4664
+ }
4665
+ }
4666
+
4667
+ /**
4668
+ * Operation getFoldersAsync
4669
+ *
4670
+ * Get all the folders
4671
+ *
4672
+ * @param int $limit Number of documents per page (required)
4673
+ * @param int $offset Index of the first document of the page (required)
4674
+ *
4675
+ * @throws \InvalidArgumentException
4676
+ * @return \GuzzleHttp\Promise\PromiseInterface
4677
+ */
4678
+ public function getFoldersAsync($limit, $offset)
4679
+ {
4680
+ return $this->getFoldersAsyncWithHttpInfo($limit, $offset)
4681
+ ->then(
4682
+ function ($response) {
4683
+ return $response[0];
4684
+ }
4685
+ );
4686
+ }
4687
+
4688
+ /**
4689
+ * Operation getFoldersAsyncWithHttpInfo
4690
+ *
4691
+ * Get all the folders
4692
+ *
4693
+ * @param int $limit Number of documents per page (required)
4694
+ * @param int $offset Index of the first document of the page (required)
4695
+ *
4696
+ * @throws \InvalidArgumentException
4697
+ * @return \GuzzleHttp\Promise\PromiseInterface
4698
+ */
4699
+ public function getFoldersAsyncWithHttpInfo($limit, $offset)
4700
+ {
4701
+ $returnType = '\SendinBlue\Client\Model\GetFolders';
4702
+ $request = $this->getFoldersRequest($limit, $offset);
4703
+
4704
+ return $this->client
4705
+ ->sendAsync($request, $this->createHttpClientOption())
4706
+ ->then(
4707
+ function ($response) use ($returnType) {
4708
+ $responseBody = $response->getBody();
4709
+ if ($returnType === '\SplFileObject') {
4710
+ $content = $responseBody; //stream goes to serializer
4711
+ } else {
4712
+ $content = $responseBody->getContents();
4713
+ if ($returnType !== 'string') {
4714
+ $content = json_decode($content);
4715
+ }
4716
+ }
4717
+
4718
+ return [
4719
+ ObjectSerializer::deserialize($content, $returnType, []),
4720
+ $response->getStatusCode(),
4721
+ $response->getHeaders()
4722
+ ];
4723
+ },
4724
+ function ($exception) {
4725
+ $response = $exception->getResponse();
4726
+ $statusCode = $response->getStatusCode();
4727
+ throw new ApiException(
4728
+ sprintf(
4729
+ '[%d] Error connecting to the API (%s)',
4730
+ $statusCode,
4731
+ $exception->getRequest()->getUri()
4732
+ ),
4733
+ $statusCode,
4734
+ $response->getHeaders(),
4735
+ $response->getBody()
4736
+ );
4737
+ }
4738
+ );
4739
+ }
4740
+
4741
+ /**
4742
+ * Create request for operation 'getFolders'
4743
+ *
4744
+ * @param int $limit Number of documents per page (required)
4745
+ * @param int $offset Index of the first document of the page (required)
4746
+ *
4747
+ * @throws \InvalidArgumentException
4748
+ * @return \GuzzleHttp\Psr7\Request
4749
+ */
4750
+ protected function getFoldersRequest($limit, $offset)
4751
+ {
4752
+ // verify the required parameter 'limit' is set
4753
+ if ($limit === null) {
4754
+ throw new \InvalidArgumentException(
4755
+ 'Missing the required parameter $limit when calling getFolders'
4756
+ );
4757
+ }
4758
+ if ($limit > 50) {
4759
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolders, must be smaller than or equal to 50.');
4760
+ }
4761
+
4762
+ // verify the required parameter 'offset' is set
4763
+ if ($offset === null) {
4764
+ throw new \InvalidArgumentException(
4765
+ 'Missing the required parameter $offset when calling getFolders'
4766
+ );
4767
+ }
4768
+
4769
+ $resourcePath = '/contacts/folders';
4770
+ $formParams = [];
4771
+ $queryParams = [];
4772
+ $headerParams = [];
4773
+ $httpBody = '';
4774
+ $multipart = false;
4775
+
4776
+ // query params
4777
+ if ($limit !== null) {
4778
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
4779
+ }
4780
+ // query params
4781
+ if ($offset !== null) {
4782
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
4783
+ }
4784
+
4785
+
4786
+ // body params
4787
+ $_tempBody = null;
4788
+
4789
+ if ($multipart) {
4790
+ $headers = $this->headerSelector->selectHeadersForMultipart(
4791
+ ['application/json']
4792
+ );
4793
+ } else {
4794
+ $headers = $this->headerSelector->selectHeaders(
4795
+ ['application/json'],
4796
+ ['application/json']
4797
+ );
4798
+ }
4799
+
4800
+ // for model (json/xml)
4801
+ if (isset($_tempBody)) {
4802
+ // $_tempBody is the method argument, if present
4803
+ $httpBody = $_tempBody;
4804
+ // \stdClass has no __toString(), so we should encode it manually
4805
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
4806
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
4807
+ }
4808
+ } elseif (count($formParams) > 0) {
4809
+ if ($multipart) {
4810
+ $multipartContents = [];
4811
+ foreach ($formParams as $formParamName => $formParamValue) {
4812
+ $multipartContents[] = [
4813
+ 'name' => $formParamName,
4814
+ 'contents' => $formParamValue
4815
+ ];
4816
+ }
4817
+ // for HTTP post (form)
4818
+ $httpBody = new MultipartStream($multipartContents);
4819
+
4820
+ } elseif ($headers['Content-Type'] === 'application/json') {
4821
+ $httpBody = \GuzzleHttp\json_encode($formParams);
4822
+
4823
+ } else {
4824
+ // for HTTP post (form)
4825
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
4826
+ }
4827
+ }
4828
+
4829
+ // this endpoint requires API key authentication
4830
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
4831
+ if ($apiKey !== null) {
4832
+ $headers['api-key'] = $apiKey;
4833
+ }
4834
+ // this endpoint requires API key authentication
4835
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
4836
+ if ($apiKey !== null) {
4837
+ $headers['partner-key'] = $apiKey;
4838
+ }
4839
+
4840
+ $defaultHeaders = [];
4841
+ if ($this->config->getUserAgent()) {
4842
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
4843
+ }
4844
+
4845
+ $headers = array_merge(
4846
+ $defaultHeaders,
4847
+ $headerParams,
4848
+ $headers
4849
+ );
4850
+
4851
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
4852
+ return new Request(
4853
+ 'GET',
4854
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
4855
+ $headers,
4856
+ $httpBody
4857
+ );
4858
+ }
4859
+
4860
+ /**
4861
+ * Operation getList
4862
+ *
4863
+ * Get the details of a list
4864
+ *
4865
+ * @param int $listId Id of the list (required)
4866
+ *
4867
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
4868
+ * @throws \InvalidArgumentException
4869
+ * @return \SendinBlue\Client\Model\GetExtendedList
4870
+ */
4871
+ public function getList($listId)
4872
+ {
4873
+ list($response) = $this->getListWithHttpInfo($listId);
4874
+ return $response;
4875
+ }
4876
+
4877
+ /**
4878
+ * Operation getListWithHttpInfo
4879
+ *
4880
+ * Get the details of a list
4881
+ *
4882
+ * @param int $listId Id of the list (required)
4883
+ *
4884
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
4885
+ * @throws \InvalidArgumentException
4886
+ * @return array of \SendinBlue\Client\Model\GetExtendedList, HTTP status code, HTTP response headers (array of strings)
4887
+ */
4888
+ public function getListWithHttpInfo($listId)
4889
+ {
4890
+ $returnType = '\SendinBlue\Client\Model\GetExtendedList';
4891
+ $request = $this->getListRequest($listId);
4892
+
4893
+ try {
4894
+ $options = $this->createHttpClientOption();
4895
+ try {
4896
+ $response = $this->client->send($request, $options);
4897
+ } catch (RequestException $e) {
4898
+ throw new ApiException(
4899
+ "[{$e->getCode()}] {$e->getMessage()}",
4900
+ $e->getCode(),
4901
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
4902
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
4903
+ );
4904
+ }
4905
+
4906
+ $statusCode = $response->getStatusCode();
4907
+
4908
+ if ($statusCode < 200 || $statusCode > 299) {
4909
+ throw new ApiException(
4910
+ sprintf(
4911
+ '[%d] Error connecting to the API (%s)',
4912
+ $statusCode,
4913
+ $request->getUri()
4914
+ ),
4915
+ $statusCode,
4916
+ $response->getHeaders(),
4917
+ $response->getBody()
4918
+ );
4919
+ }
4920
+
4921
+ $responseBody = $response->getBody();
4922
+ if ($returnType === '\SplFileObject') {
4923
+ $content = $responseBody; //stream goes to serializer
4924
+ } else {
4925
+ $content = $responseBody->getContents();
4926
+ if ($returnType !== 'string') {
4927
+ $content = json_decode($content);
4928
+ }
4929
+ }
4930
+
4931
+ return [
4932
+ ObjectSerializer::deserialize($content, $returnType, []),
4933
+ $response->getStatusCode(),
4934
+ $response->getHeaders()
4935
+ ];
4936
+
4937
+ } catch (ApiException $e) {
4938
+ switch ($e->getCode()) {
4939
+ case 200:
4940
+ $data = ObjectSerializer::deserialize(
4941
+ $e->getResponseBody(),
4942
+ '\SendinBlue\Client\Model\GetExtendedList',
4943
+ $e->getResponseHeaders()
4944
+ );
4945
+ $e->setResponseObject($data);
4946
+ break;
4947
+ case 400:
4948
+ $data = ObjectSerializer::deserialize(
4949
+ $e->getResponseBody(),
4950
+ '\SendinBlue\Client\Model\ErrorModel',
4951
+ $e->getResponseHeaders()
4952
+ );
4953
+ $e->setResponseObject($data);
4954
+ break;
4955
+ case 404:
4956
+ $data = ObjectSerializer::deserialize(
4957
+ $e->getResponseBody(),
4958
+ '\SendinBlue\Client\Model\ErrorModel',
4959
+ $e->getResponseHeaders()
4960
+ );
4961
+ $e->setResponseObject($data);
4962
+ break;
4963
+ }
4964
+ throw $e;
4965
+ }
4966
+ }
4967
+
4968
+ /**
4969
+ * Operation getListAsync
4970
+ *
4971
+ * Get the details of a list
4972
+ *
4973
+ * @param int $listId Id of the list (required)
4974
+ *
4975
+ * @throws \InvalidArgumentException
4976
+ * @return \GuzzleHttp\Promise\PromiseInterface
4977
+ */
4978
+ public function getListAsync($listId)
4979
+ {
4980
+ return $this->getListAsyncWithHttpInfo($listId)
4981
+ ->then(
4982
+ function ($response) {
4983
+ return $response[0];
4984
+ }
4985
+ );
4986
+ }
4987
+
4988
+ /**
4989
+ * Operation getListAsyncWithHttpInfo
4990
+ *
4991
+ * Get the details of a list
4992
+ *
4993
+ * @param int $listId Id of the list (required)
4994
+ *
4995
+ * @throws \InvalidArgumentException
4996
+ * @return \GuzzleHttp\Promise\PromiseInterface
4997
+ */
4998
+ public function getListAsyncWithHttpInfo($listId)
4999
+ {
5000
+ $returnType = '\SendinBlue\Client\Model\GetExtendedList';
5001
+ $request = $this->getListRequest($listId);
5002
+
5003
+ return $this->client
5004
+ ->sendAsync($request, $this->createHttpClientOption())
5005
+ ->then(
5006
+ function ($response) use ($returnType) {
5007
+ $responseBody = $response->getBody();
5008
+ if ($returnType === '\SplFileObject') {
5009
+ $content = $responseBody; //stream goes to serializer
5010
+ } else {
5011
+ $content = $responseBody->getContents();
5012
+ if ($returnType !== 'string') {
5013
+ $content = json_decode($content);
5014
+ }
5015
+ }
5016
+
5017
+ return [
5018
+ ObjectSerializer::deserialize($content, $returnType, []),
5019
+ $response->getStatusCode(),
5020
+ $response->getHeaders()
5021
+ ];
5022
+ },
5023
+ function ($exception) {
5024
+ $response = $exception->getResponse();
5025
+ $statusCode = $response->getStatusCode();
5026
+ throw new ApiException(
5027
+ sprintf(
5028
+ '[%d] Error connecting to the API (%s)',
5029
+ $statusCode,
5030
+ $exception->getRequest()->getUri()
5031
+ ),
5032
+ $statusCode,
5033
+ $response->getHeaders(),
5034
+ $response->getBody()
5035
+ );
5036
+ }
5037
+ );
5038
+ }
5039
+
5040
+ /**
5041
+ * Create request for operation 'getList'
5042
+ *
5043
+ * @param int $listId Id of the list (required)
5044
+ *
5045
+ * @throws \InvalidArgumentException
5046
+ * @return \GuzzleHttp\Psr7\Request
5047
+ */
5048
+ protected function getListRequest($listId)
5049
+ {
5050
+ // verify the required parameter 'listId' is set
5051
+ if ($listId === null) {
5052
+ throw new \InvalidArgumentException(
5053
+ 'Missing the required parameter $listId when calling getList'
5054
+ );
5055
+ }
5056
+
5057
+ $resourcePath = '/contacts/lists/{listId}';
5058
+ $formParams = [];
5059
+ $queryParams = [];
5060
+ $headerParams = [];
5061
+ $httpBody = '';
5062
+ $multipart = false;
5063
+
5064
+
5065
+ // path params
5066
+ if ($listId !== null) {
5067
+ $resourcePath = str_replace(
5068
+ '{' . 'listId' . '}',
5069
+ ObjectSerializer::toPathValue($listId),
5070
+ $resourcePath
5071
+ );
5072
+ }
5073
+
5074
+ // body params
5075
+ $_tempBody = null;
5076
+
5077
+ if ($multipart) {
5078
+ $headers = $this->headerSelector->selectHeadersForMultipart(
5079
+ ['application/json']
5080
+ );
5081
+ } else {
5082
+ $headers = $this->headerSelector->selectHeaders(
5083
+ ['application/json'],
5084
+ ['application/json']
5085
+ );
5086
+ }
5087
+
5088
+ // for model (json/xml)
5089
+ if (isset($_tempBody)) {
5090
+ // $_tempBody is the method argument, if present
5091
+ $httpBody = $_tempBody;
5092
+ // \stdClass has no __toString(), so we should encode it manually
5093
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
5094
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
5095
+ }
5096
+ } elseif (count($formParams) > 0) {
5097
+ if ($multipart) {
5098
+ $multipartContents = [];
5099
+ foreach ($formParams as $formParamName => $formParamValue) {
5100
+ $multipartContents[] = [
5101
+ 'name' => $formParamName,
5102
+ 'contents' => $formParamValue
5103
+ ];
5104
+ }
5105
+ // for HTTP post (form)
5106
+ $httpBody = new MultipartStream($multipartContents);
5107
+
5108
+ } elseif ($headers['Content-Type'] === 'application/json') {
5109
+ $httpBody = \GuzzleHttp\json_encode($formParams);
5110
+
5111
+ } else {
5112
+ // for HTTP post (form)
5113
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
5114
+ }
5115
+ }
5116
+
5117
+ // this endpoint requires API key authentication
5118
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
5119
+ if ($apiKey !== null) {
5120
+ $headers['api-key'] = $apiKey;
5121
+ }
5122
+ // this endpoint requires API key authentication
5123
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
5124
+ if ($apiKey !== null) {
5125
+ $headers['partner-key'] = $apiKey;
5126
+ }
5127
+
5128
+ $defaultHeaders = [];
5129
+ if ($this->config->getUserAgent()) {
5130
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
5131
+ }
5132
+
5133
+ $headers = array_merge(
5134
+ $defaultHeaders,
5135
+ $headerParams,
5136
+ $headers
5137
+ );
5138
+
5139
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
5140
+ return new Request(
5141
+ 'GET',
5142
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
5143
+ $headers,
5144
+ $httpBody
5145
+ );
5146
+ }
5147
+
5148
+ /**
5149
+ * Operation getLists
5150
+ *
5151
+ * Get all the lists
5152
+ *
5153
+ * @param int $limit Number of documents per page (optional, default to 10)
5154
+ * @param int $offset Index of the first document of the page (optional, default to 0)
5155
+ *
5156
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
5157
+ * @throws \InvalidArgumentException
5158
+ * @return \SendinBlue\Client\Model\GetLists
5159
+ */
5160
+ public function getLists($limit = '10', $offset = '0')
5161
+ {
5162
+ list($response) = $this->getListsWithHttpInfo($limit, $offset);
5163
+ return $response;
5164
+ }
5165
+
5166
+ /**
5167
+ * Operation getListsWithHttpInfo
5168
+ *
5169
+ * Get all the lists
5170
+ *
5171
+ * @param int $limit Number of documents per page (optional, default to 10)
5172
+ * @param int $offset Index of the first document of the page (optional, default to 0)
5173
+ *
5174
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
5175
+ * @throws \InvalidArgumentException
5176
+ * @return array of \SendinBlue\Client\Model\GetLists, HTTP status code, HTTP response headers (array of strings)
5177
+ */
5178
+ public function getListsWithHttpInfo($limit = '10', $offset = '0')
5179
+ {
5180
+ $returnType = '\SendinBlue\Client\Model\GetLists';
5181
+ $request = $this->getListsRequest($limit, $offset);
5182
+
5183
+ try {
5184
+ $options = $this->createHttpClientOption();
5185
+ try {
5186
+ $response = $this->client->send($request, $options);
5187
+ } catch (RequestException $e) {
5188
+ throw new ApiException(
5189
+ "[{$e->getCode()}] {$e->getMessage()}",
5190
+ $e->getCode(),
5191
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
5192
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
5193
+ );
5194
+ }
5195
+
5196
+ $statusCode = $response->getStatusCode();
5197
+
5198
+ if ($statusCode < 200 || $statusCode > 299) {
5199
+ throw new ApiException(
5200
+ sprintf(
5201
+ '[%d] Error connecting to the API (%s)',
5202
+ $statusCode,
5203
+ $request->getUri()
5204
+ ),
5205
+ $statusCode,
5206
+ $response->getHeaders(),
5207
+ $response->getBody()
5208
+ );
5209
+ }
5210
+
5211
+ $responseBody = $response->getBody();
5212
+ if ($returnType === '\SplFileObject') {
5213
+ $content = $responseBody; //stream goes to serializer
5214
+ } else {
5215
+ $content = $responseBody->getContents();
5216
+ if ($returnType !== 'string') {
5217
+ $content = json_decode($content);
5218
+ }
5219
+ }
5220
+
5221
+ return [
5222
+ ObjectSerializer::deserialize($content, $returnType, []),
5223
+ $response->getStatusCode(),
5224
+ $response->getHeaders()
5225
+ ];
5226
+
5227
+ } catch (ApiException $e) {
5228
+ switch ($e->getCode()) {
5229
+ case 200:
5230
+ $data = ObjectSerializer::deserialize(
5231
+ $e->getResponseBody(),
5232
+ '\SendinBlue\Client\Model\GetLists',
5233
+ $e->getResponseHeaders()
5234
+ );
5235
+ $e->setResponseObject($data);
5236
+ break;
5237
+ case 400:
5238
+ $data = ObjectSerializer::deserialize(
5239
+ $e->getResponseBody(),
5240
+ '\SendinBlue\Client\Model\ErrorModel',
5241
+ $e->getResponseHeaders()
5242
+ );
5243
+ $e->setResponseObject($data);
5244
+ break;
5245
+ }
5246
+ throw $e;
5247
+ }
5248
+ }
5249
+
5250
+ /**
5251
+ * Operation getListsAsync
5252
+ *
5253
+ * Get all the lists
5254
+ *
5255
+ * @param int $limit Number of documents per page (optional, default to 10)
5256
+ * @param int $offset Index of the first document of the page (optional, default to 0)
5257
+ *
5258
+ * @throws \InvalidArgumentException
5259
+ * @return \GuzzleHttp\Promise\PromiseInterface
5260
+ */
5261
+ public function getListsAsync($limit = '10', $offset = '0')
5262
+ {
5263
+ return $this->getListsAsyncWithHttpInfo($limit, $offset)
5264
+ ->then(
5265
+ function ($response) {
5266
+ return $response[0];
5267
+ }
5268
+ );
5269
+ }
5270
+
5271
+ /**
5272
+ * Operation getListsAsyncWithHttpInfo
5273
+ *
5274
+ * Get all the lists
5275
+ *
5276
+ * @param int $limit Number of documents per page (optional, default to 10)
5277
+ * @param int $offset Index of the first document of the page (optional, default to 0)
5278
+ *
5279
+ * @throws \InvalidArgumentException
5280
+ * @return \GuzzleHttp\Promise\PromiseInterface
5281
+ */
5282
+ public function getListsAsyncWithHttpInfo($limit = '10', $offset = '0')
5283
+ {
5284
+ $returnType = '\SendinBlue\Client\Model\GetLists';
5285
+ $request = $this->getListsRequest($limit, $offset);
5286
+
5287
+ return $this->client
5288
+ ->sendAsync($request, $this->createHttpClientOption())
5289
+ ->then(
5290
+ function ($response) use ($returnType) {
5291
+ $responseBody = $response->getBody();
5292
+ if ($returnType === '\SplFileObject') {
5293
+ $content = $responseBody; //stream goes to serializer
5294
+ } else {
5295
+ $content = $responseBody->getContents();
5296
+ if ($returnType !== 'string') {
5297
+ $content = json_decode($content);
5298
+ }
5299
+ }
5300
+
5301
+ return [
5302
+ ObjectSerializer::deserialize($content, $returnType, []),
5303
+ $response->getStatusCode(),
5304
+ $response->getHeaders()
5305
+ ];
5306
+ },
5307
+ function ($exception) {
5308
+ $response = $exception->getResponse();
5309
+ $statusCode = $response->getStatusCode();
5310
+ throw new ApiException(
5311
+ sprintf(
5312
+ '[%d] Error connecting to the API (%s)',
5313
+ $statusCode,
5314
+ $exception->getRequest()->getUri()
5315
+ ),
5316
+ $statusCode,
5317
+ $response->getHeaders(),
5318
+ $response->getBody()
5319
+ );
5320
+ }
5321
+ );
5322
+ }
5323
+
5324
+ /**
5325
+ * Create request for operation 'getLists'
5326
+ *
5327
+ * @param int $limit Number of documents per page (optional, default to 10)
5328
+ * @param int $offset Index of the first document of the page (optional, default to 0)
5329
+ *
5330
+ * @throws \InvalidArgumentException
5331
+ * @return \GuzzleHttp\Psr7\Request
5332
+ */
5333
+ protected function getListsRequest($limit = '10', $offset = '0')
5334
+ {
5335
+ if ($limit !== null && $limit > 50) {
5336
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getLists, must be smaller than or equal to 50.');
5337
+ }
5338
+
5339
+
5340
+ $resourcePath = '/contacts/lists';
5341
+ $formParams = [];
5342
+ $queryParams = [];
5343
+ $headerParams = [];
5344
+ $httpBody = '';
5345
+ $multipart = false;
5346
+
5347
+ // query params
5348
+ if ($limit !== null) {
5349
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
5350
+ }
5351
+ // query params
5352
+ if ($offset !== null) {
5353
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
5354
+ }
5355
+
5356
+
5357
+ // body params
5358
+ $_tempBody = null;
5359
+
5360
+ if ($multipart) {
5361
+ $headers = $this->headerSelector->selectHeadersForMultipart(
5362
+ ['application/json']
5363
+ );
5364
+ } else {
5365
+ $headers = $this->headerSelector->selectHeaders(
5366
+ ['application/json'],
5367
+ ['application/json']
5368
+ );
5369
+ }
5370
+
5371
+ // for model (json/xml)
5372
+ if (isset($_tempBody)) {
5373
+ // $_tempBody is the method argument, if present
5374
+ $httpBody = $_tempBody;
5375
+ // \stdClass has no __toString(), so we should encode it manually
5376
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
5377
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
5378
+ }
5379
+ } elseif (count($formParams) > 0) {
5380
+ if ($multipart) {
5381
+ $multipartContents = [];
5382
+ foreach ($formParams as $formParamName => $formParamValue) {
5383
+ $multipartContents[] = [
5384
+ 'name' => $formParamName,
5385
+ 'contents' => $formParamValue
5386
+ ];
5387
+ }
5388
+ // for HTTP post (form)
5389
+ $httpBody = new MultipartStream($multipartContents);
5390
+
5391
+ } elseif ($headers['Content-Type'] === 'application/json') {
5392
+ $httpBody = \GuzzleHttp\json_encode($formParams);
5393
+
5394
+ } else {
5395
+ // for HTTP post (form)
5396
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
5397
+ }
5398
+ }
5399
+
5400
+ // this endpoint requires API key authentication
5401
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
5402
+ if ($apiKey !== null) {
5403
+ $headers['api-key'] = $apiKey;
5404
+ }
5405
+ // this endpoint requires API key authentication
5406
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
5407
+ if ($apiKey !== null) {
5408
+ $headers['partner-key'] = $apiKey;
5409
+ }
5410
+
5411
+ $defaultHeaders = [];
5412
+ if ($this->config->getUserAgent()) {
5413
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
5414
+ }
5415
+
5416
+ $headers = array_merge(
5417
+ $defaultHeaders,
5418
+ $headerParams,
5419
+ $headers
5420
+ );
5421
+
5422
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
5423
+ return new Request(
5424
+ 'GET',
5425
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
5426
+ $headers,
5427
+ $httpBody
5428
+ );
5429
+ }
5430
+
5431
+ /**
5432
+ * Operation importContacts
5433
+ *
5434
+ * Import contacts
5435
+ *
5436
+ * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at &#x60;&#x60;https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns&#x60;&#x60; (required)
5437
+ *
5438
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
5439
+ * @throws \InvalidArgumentException
5440
+ * @return \SendinBlue\Client\Model\CreatedProcessId
5441
+ */
5442
+ public function importContacts($requestContactImport)
5443
+ {
5444
+ list($response) = $this->importContactsWithHttpInfo($requestContactImport);
5445
+ return $response;
5446
+ }
5447
+
5448
+ /**
5449
+ * Operation importContactsWithHttpInfo
5450
+ *
5451
+ * Import contacts
5452
+ *
5453
+ * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at &#x60;&#x60;https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns&#x60;&#x60; (required)
5454
+ *
5455
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
5456
+ * @throws \InvalidArgumentException
5457
+ * @return array of \SendinBlue\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings)
5458
+ */
5459
+ public function importContactsWithHttpInfo($requestContactImport)
5460
+ {
5461
+ $returnType = '\SendinBlue\Client\Model\CreatedProcessId';
5462
+ $request = $this->importContactsRequest($requestContactImport);
5463
+
5464
+ try {
5465
+ $options = $this->createHttpClientOption();
5466
+ try {
5467
+ $response = $this->client->send($request, $options);
5468
+ } catch (RequestException $e) {
5469
+ throw new ApiException(
5470
+ "[{$e->getCode()}] {$e->getMessage()}",
5471
+ $e->getCode(),
5472
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
5473
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
5474
+ );
5475
+ }
5476
+
5477
+ $statusCode = $response->getStatusCode();
5478
+
5479
+ if ($statusCode < 200 || $statusCode > 299) {
5480
+ throw new ApiException(
5481
+ sprintf(
5482
+ '[%d] Error connecting to the API (%s)',
5483
+ $statusCode,
5484
+ $request->getUri()
5485
+ ),
5486
+ $statusCode,
5487
+ $response->getHeaders(),
5488
+ $response->getBody()
5489
+ );
5490
+ }
5491
+
5492
+ $responseBody = $response->getBody();
5493
+ if ($returnType === '\SplFileObject') {
5494
+ $content = $responseBody; //stream goes to serializer
5495
+ } else {
5496
+ $content = $responseBody->getContents();
5497
+ if ($returnType !== 'string') {
5498
+ $content = json_decode($content);
5499
+ }
5500
+ }
5501
+
5502
+ return [
5503
+ ObjectSerializer::deserialize($content, $returnType, []),
5504
+ $response->getStatusCode(),
5505
+ $response->getHeaders()
5506
+ ];
5507
+
5508
+ } catch (ApiException $e) {
5509
+ switch ($e->getCode()) {
5510
+ case 202:
5511
+ $data = ObjectSerializer::deserialize(
5512
+ $e->getResponseBody(),
5513
+ '\SendinBlue\Client\Model\CreatedProcessId',
5514
+ $e->getResponseHeaders()
5515
+ );
5516
+ $e->setResponseObject($data);
5517
+ break;
5518
+ case 400:
5519
+ $data = ObjectSerializer::deserialize(
5520
+ $e->getResponseBody(),
5521
+ '\SendinBlue\Client\Model\ErrorModel',
5522
+ $e->getResponseHeaders()
5523
+ );
5524
+ $e->setResponseObject($data);
5525
+ break;
5526
+ }
5527
+ throw $e;
5528
+ }
5529
+ }
5530
+
5531
+ /**
5532
+ * Operation importContactsAsync
5533
+ *
5534
+ * Import contacts
5535
+ *
5536
+ * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at &#x60;&#x60;https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns&#x60;&#x60; (required)
5537
+ *
5538
+ * @throws \InvalidArgumentException
5539
+ * @return \GuzzleHttp\Promise\PromiseInterface
5540
+ */
5541
+ public function importContactsAsync($requestContactImport)
5542
+ {
5543
+ return $this->importContactsAsyncWithHttpInfo($requestContactImport)
5544
+ ->then(
5545
+ function ($response) {
5546
+ return $response[0];
5547
+ }
5548
+ );
5549
+ }
5550
+
5551
+ /**
5552
+ * Operation importContactsAsyncWithHttpInfo
5553
+ *
5554
+ * Import contacts
5555
+ *
5556
+ * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at &#x60;&#x60;https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns&#x60;&#x60; (required)
5557
+ *
5558
+ * @throws \InvalidArgumentException
5559
+ * @return \GuzzleHttp\Promise\PromiseInterface
5560
+ */
5561
+ public function importContactsAsyncWithHttpInfo($requestContactImport)
5562
+ {
5563
+ $returnType = '\SendinBlue\Client\Model\CreatedProcessId';
5564
+ $request = $this->importContactsRequest($requestContactImport);
5565
+
5566
+ return $this->client
5567
+ ->sendAsync($request, $this->createHttpClientOption())
5568
+ ->then(
5569
+ function ($response) use ($returnType) {
5570
+ $responseBody = $response->getBody();
5571
+ if ($returnType === '\SplFileObject') {
5572
+ $content = $responseBody; //stream goes to serializer
5573
+ } else {
5574
+ $content = $responseBody->getContents();
5575
+ if ($returnType !== 'string') {
5576
+ $content = json_decode($content);
5577
+ }
5578
+ }
5579
+
5580
+ return [
5581
+ ObjectSerializer::deserialize($content, $returnType, []),
5582
+ $response->getStatusCode(),
5583
+ $response->getHeaders()
5584
+ ];
5585
+ },
5586
+ function ($exception) {
5587
+ $response = $exception->getResponse();
5588
+ $statusCode = $response->getStatusCode();
5589
+ throw new ApiException(
5590
+ sprintf(
5591
+ '[%d] Error connecting to the API (%s)',
5592
+ $statusCode,
5593
+ $exception->getRequest()->getUri()
5594
+ ),
5595
+ $statusCode,
5596
+ $response->getHeaders(),
5597
+ $response->getBody()
5598
+ );
5599
+ }
5600
+ );
5601
+ }
5602
+
5603
+ /**
5604
+ * Create request for operation 'importContacts'
5605
+ *
5606
+ * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at &#x60;&#x60;https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns&#x60;&#x60; (required)
5607
+ *
5608
+ * @throws \InvalidArgumentException
5609
+ * @return \GuzzleHttp\Psr7\Request
5610
+ */
5611
+ protected function importContactsRequest($requestContactImport)
5612
+ {
5613
+ // verify the required parameter 'requestContactImport' is set
5614
+ if ($requestContactImport === null) {
5615
+ throw new \InvalidArgumentException(
5616
+ 'Missing the required parameter $requestContactImport when calling importContacts'
5617
+ );
5618
+ }
5619
+
5620
+ $resourcePath = '/contacts/import';
5621
+ $formParams = [];
5622
+ $queryParams = [];
5623
+ $headerParams = [];
5624
+ $httpBody = '';
5625
+ $multipart = false;
5626
+
5627
+
5628
+
5629
+ // body params
5630
+ $_tempBody = null;
5631
+ if (isset($requestContactImport)) {
5632
+ $_tempBody = $requestContactImport;
5633
+ }
5634
+
5635
+ if ($multipart) {
5636
+ $headers = $this->headerSelector->selectHeadersForMultipart(
5637
+ ['application/json']
5638
+ );
5639
+ } else {
5640
+ $headers = $this->headerSelector->selectHeaders(
5641
+ ['application/json'],
5642
+ ['application/json']
5643
+ );
5644
+ }
5645
+
5646
+ // for model (json/xml)
5647
+ if (isset($_tempBody)) {
5648
+ // $_tempBody is the method argument, if present
5649
+ $httpBody = $_tempBody;
5650
+ // \stdClass has no __toString(), so we should encode it manually
5651
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
5652
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
5653
+ }
5654
+ } elseif (count($formParams) > 0) {
5655
+ if ($multipart) {
5656
+ $multipartContents = [];
5657
+ foreach ($formParams as $formParamName => $formParamValue) {
5658
+ $multipartContents[] = [
5659
+ 'name' => $formParamName,
5660
+ 'contents' => $formParamValue
5661
+ ];
5662
+ }
5663
+ // for HTTP post (form)
5664
+ $httpBody = new MultipartStream($multipartContents);
5665
+
5666
+ } elseif ($headers['Content-Type'] === 'application/json') {
5667
+ $httpBody = \GuzzleHttp\json_encode($formParams);
5668
+
5669
+ } else {
5670
+ // for HTTP post (form)
5671
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
5672
+ }
5673
+ }
5674
+
5675
+ // this endpoint requires API key authentication
5676
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
5677
+ if ($apiKey !== null) {
5678
+ $headers['api-key'] = $apiKey;
5679
+ }
5680
+ // this endpoint requires API key authentication
5681
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
5682
+ if ($apiKey !== null) {
5683
+ $headers['partner-key'] = $apiKey;
5684
+ }
5685
+
5686
+ $defaultHeaders = [];
5687
+ if ($this->config->getUserAgent()) {
5688
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
5689
+ }
5690
+
5691
+ $headers = array_merge(
5692
+ $defaultHeaders,
5693
+ $headerParams,
5694
+ $headers
5695
+ );
5696
+
5697
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
5698
+ return new Request(
5699
+ 'POST',
5700
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
5701
+ $headers,
5702
+ $httpBody
5703
+ );
5704
+ }
5705
+
5706
+ /**
5707
+ * Operation removeContactFromList
5708
+ *
5709
+ * Remove existing contacts from a list
5710
+ *
5711
+ * @param int $listId Id of the list (required)
5712
+ * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required)
5713
+ *
5714
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
5715
+ * @throws \InvalidArgumentException
5716
+ * @return \SendinBlue\Client\Model\PostContactInfo
5717
+ */
5718
+ public function removeContactFromList($listId, $contactEmails)
5719
+ {
5720
+ list($response) = $this->removeContactFromListWithHttpInfo($listId, $contactEmails);
5721
+ return $response;
5722
+ }
5723
+
5724
+ /**
5725
+ * Operation removeContactFromListWithHttpInfo
5726
+ *
5727
+ * Remove existing contacts from a list
5728
+ *
5729
+ * @param int $listId Id of the list (required)
5730
+ * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required)
5731
+ *
5732
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
5733
+ * @throws \InvalidArgumentException
5734
+ * @return array of \SendinBlue\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings)
5735
+ */
5736
+ public function removeContactFromListWithHttpInfo($listId, $contactEmails)
5737
+ {
5738
+ $returnType = '\SendinBlue\Client\Model\PostContactInfo';
5739
+ $request = $this->removeContactFromListRequest($listId, $contactEmails);
5740
+
5741
+ try {
5742
+ $options = $this->createHttpClientOption();
5743
+ try {
5744
+ $response = $this->client->send($request, $options);
5745
+ } catch (RequestException $e) {
5746
+ throw new ApiException(
5747
+ "[{$e->getCode()}] {$e->getMessage()}",
5748
+ $e->getCode(),
5749
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
5750
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
5751
+ );
5752
+ }
5753
+
5754
+ $statusCode = $response->getStatusCode();
5755
+
5756
+ if ($statusCode < 200 || $statusCode > 299) {
5757
+ throw new ApiException(
5758
+ sprintf(
5759
+ '[%d] Error connecting to the API (%s)',
5760
+ $statusCode,
5761
+ $request->getUri()
5762
+ ),
5763
+ $statusCode,
5764
+ $response->getHeaders(),
5765
+ $response->getBody()
5766
+ );
5767
+ }
5768
+
5769
+ $responseBody = $response->getBody();
5770
+ if ($returnType === '\SplFileObject') {
5771
+ $content = $responseBody; //stream goes to serializer
5772
+ } else {
5773
+ $content = $responseBody->getContents();
5774
+ if ($returnType !== 'string') {
5775
+ $content = json_decode($content);
5776
+ }
5777
+ }
5778
+
5779
+ return [
5780
+ ObjectSerializer::deserialize($content, $returnType, []),
5781
+ $response->getStatusCode(),
5782
+ $response->getHeaders()
5783
+ ];
5784
+
5785
+ } catch (ApiException $e) {
5786
+ switch ($e->getCode()) {
5787
+ case 201:
5788
+ $data = ObjectSerializer::deserialize(
5789
+ $e->getResponseBody(),
5790
+ '\SendinBlue\Client\Model\PostContactInfo',
5791
+ $e->getResponseHeaders()
5792
+ );
5793
+ $e->setResponseObject($data);
5794
+ break;
5795
+ case 400:
5796
+ $data = ObjectSerializer::deserialize(
5797
+ $e->getResponseBody(),
5798
+ '\SendinBlue\Client\Model\ErrorModel',
5799
+ $e->getResponseHeaders()
5800
+ );
5801
+ $e->setResponseObject($data);
5802
+ break;
5803
+ case 404:
5804
+ $data = ObjectSerializer::deserialize(
5805
+ $e->getResponseBody(),
5806
+ '\SendinBlue\Client\Model\ErrorModel',
5807
+ $e->getResponseHeaders()
5808
+ );
5809
+ $e->setResponseObject($data);
5810
+ break;
5811
+ }
5812
+ throw $e;
5813
+ }
5814
+ }
5815
+
5816
+ /**
5817
+ * Operation removeContactFromListAsync
5818
+ *
5819
+ * Remove existing contacts from a list
5820
+ *
5821
+ * @param int $listId Id of the list (required)
5822
+ * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required)
5823
+ *
5824
+ * @throws \InvalidArgumentException
5825
+ * @return \GuzzleHttp\Promise\PromiseInterface
5826
+ */
5827
+ public function removeContactFromListAsync($listId, $contactEmails)
5828
+ {
5829
+ return $this->removeContactFromListAsyncWithHttpInfo($listId, $contactEmails)
5830
+ ->then(
5831
+ function ($response) {
5832
+ return $response[0];
5833
+ }
5834
+ );
5835
+ }
5836
+
5837
+ /**
5838
+ * Operation removeContactFromListAsyncWithHttpInfo
5839
+ *
5840
+ * Remove existing contacts from a list
5841
+ *
5842
+ * @param int $listId Id of the list (required)
5843
+ * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required)
5844
+ *
5845
+ * @throws \InvalidArgumentException
5846
+ * @return \GuzzleHttp\Promise\PromiseInterface
5847
+ */
5848
+ public function removeContactFromListAsyncWithHttpInfo($listId, $contactEmails)
5849
+ {
5850
+ $returnType = '\SendinBlue\Client\Model\PostContactInfo';
5851
+ $request = $this->removeContactFromListRequest($listId, $contactEmails);
5852
+
5853
+ return $this->client
5854
+ ->sendAsync($request, $this->createHttpClientOption())
5855
+ ->then(
5856
+ function ($response) use ($returnType) {
5857
+ $responseBody = $response->getBody();
5858
+ if ($returnType === '\SplFileObject') {
5859
+ $content = $responseBody; //stream goes to serializer
5860
+ } else {
5861
+ $content = $responseBody->getContents();
5862
+ if ($returnType !== 'string') {
5863
+ $content = json_decode($content);
5864
+ }
5865
+ }
5866
+
5867
+ return [
5868
+ ObjectSerializer::deserialize($content, $returnType, []),
5869
+ $response->getStatusCode(),
5870
+ $response->getHeaders()
5871
+ ];
5872
+ },
5873
+ function ($exception) {
5874
+ $response = $exception->getResponse();
5875
+ $statusCode = $response->getStatusCode();
5876
+ throw new ApiException(
5877
+ sprintf(
5878
+ '[%d] Error connecting to the API (%s)',
5879
+ $statusCode,
5880
+ $exception->getRequest()->getUri()
5881
+ ),
5882
+ $statusCode,
5883
+ $response->getHeaders(),
5884
+ $response->getBody()
5885
+ );
5886
+ }
5887
+ );
5888
+ }
5889
+
5890
+ /**
5891
+ * Create request for operation 'removeContactFromList'
5892
+ *
5893
+ * @param int $listId Id of the list (required)
5894
+ * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required)
5895
+ *
5896
+ * @throws \InvalidArgumentException
5897
+ * @return \GuzzleHttp\Psr7\Request
5898
+ */
5899
+ protected function removeContactFromListRequest($listId, $contactEmails)
5900
+ {
5901
+ // verify the required parameter 'listId' is set
5902
+ if ($listId === null) {
5903
+ throw new \InvalidArgumentException(
5904
+ 'Missing the required parameter $listId when calling removeContactFromList'
5905
+ );
5906
+ }
5907
+ // verify the required parameter 'contactEmails' is set
5908
+ if ($contactEmails === null) {
5909
+ throw new \InvalidArgumentException(
5910
+ 'Missing the required parameter $contactEmails when calling removeContactFromList'
5911
+ );
5912
+ }
5913
+
5914
+ $resourcePath = '/contacts/lists/{listId}/contacts/remove';
5915
+ $formParams = [];
5916
+ $queryParams = [];
5917
+ $headerParams = [];
5918
+ $httpBody = '';
5919
+ $multipart = false;
5920
+
5921
+
5922
+ // path params
5923
+ if ($listId !== null) {
5924
+ $resourcePath = str_replace(
5925
+ '{' . 'listId' . '}',
5926
+ ObjectSerializer::toPathValue($listId),
5927
+ $resourcePath
5928
+ );
5929
+ }
5930
+
5931
+ // body params
5932
+ $_tempBody = null;
5933
+ if (isset($contactEmails)) {
5934
+ $_tempBody = $contactEmails;
5935
+ }
5936
+
5937
+ if ($multipart) {
5938
+ $headers = $this->headerSelector->selectHeadersForMultipart(
5939
+ ['application/json']
5940
+ );
5941
+ } else {
5942
+ $headers = $this->headerSelector->selectHeaders(
5943
+ ['application/json'],
5944
+ ['application/json']
5945
+ );
5946
+ }
5947
+
5948
+ // for model (json/xml)
5949
+ if (isset($_tempBody)) {
5950
+ // $_tempBody is the method argument, if present
5951
+ $httpBody = $_tempBody;
5952
+ // \stdClass has no __toString(), so we should encode it manually
5953
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
5954
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
5955
+ }
5956
+ } elseif (count($formParams) > 0) {
5957
+ if ($multipart) {
5958
+ $multipartContents = [];
5959
+ foreach ($formParams as $formParamName => $formParamValue) {
5960
+ $multipartContents[] = [
5961
+ 'name' => $formParamName,
5962
+ 'contents' => $formParamValue
5963
+ ];
5964
+ }
5965
+ // for HTTP post (form)
5966
+ $httpBody = new MultipartStream($multipartContents);
5967
+
5968
+ } elseif ($headers['Content-Type'] === 'application/json') {
5969
+ $httpBody = \GuzzleHttp\json_encode($formParams);
5970
+
5971
+ } else {
5972
+ // for HTTP post (form)
5973
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
5974
+ }
5975
+ }
5976
+
5977
+ // this endpoint requires API key authentication
5978
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
5979
+ if ($apiKey !== null) {
5980
+ $headers['api-key'] = $apiKey;
5981
+ }
5982
+ // this endpoint requires API key authentication
5983
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
5984
+ if ($apiKey !== null) {
5985
+ $headers['partner-key'] = $apiKey;
5986
+ }
5987
+
5988
+ $defaultHeaders = [];
5989
+ if ($this->config->getUserAgent()) {
5990
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
5991
+ }
5992
+
5993
+ $headers = array_merge(
5994
+ $defaultHeaders,
5995
+ $headerParams,
5996
+ $headers
5997
+ );
5998
+
5999
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
6000
+ return new Request(
6001
+ 'POST',
6002
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
6003
+ $headers,
6004
+ $httpBody
6005
+ );
6006
+ }
6007
+
6008
+ /**
6009
+ * Operation requestContactExport
6010
+ *
6011
+ * Export contacts
6012
+ *
6013
+ * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required)
6014
+ *
6015
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
6016
+ * @throws \InvalidArgumentException
6017
+ * @return \SendinBlue\Client\Model\CreatedProcessId
6018
+ */
6019
+ public function requestContactExport($requestContactExport)
6020
+ {
6021
+ list($response) = $this->requestContactExportWithHttpInfo($requestContactExport);
6022
+ return $response;
6023
+ }
6024
+
6025
+ /**
6026
+ * Operation requestContactExportWithHttpInfo
6027
+ *
6028
+ * Export contacts
6029
+ *
6030
+ * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required)
6031
+ *
6032
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
6033
+ * @throws \InvalidArgumentException
6034
+ * @return array of \SendinBlue\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings)
6035
+ */
6036
+ public function requestContactExportWithHttpInfo($requestContactExport)
6037
+ {
6038
+ $returnType = '\SendinBlue\Client\Model\CreatedProcessId';
6039
+ $request = $this->requestContactExportRequest($requestContactExport);
6040
+
6041
+ try {
6042
+ $options = $this->createHttpClientOption();
6043
+ try {
6044
+ $response = $this->client->send($request, $options);
6045
+ } catch (RequestException $e) {
6046
+ throw new ApiException(
6047
+ "[{$e->getCode()}] {$e->getMessage()}",
6048
+ $e->getCode(),
6049
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
6050
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
6051
+ );
6052
+ }
6053
+
6054
+ $statusCode = $response->getStatusCode();
6055
+
6056
+ if ($statusCode < 200 || $statusCode > 299) {
6057
+ throw new ApiException(
6058
+ sprintf(
6059
+ '[%d] Error connecting to the API (%s)',
6060
+ $statusCode,
6061
+ $request->getUri()
6062
+ ),
6063
+ $statusCode,
6064
+ $response->getHeaders(),
6065
+ $response->getBody()
6066
+ );
6067
+ }
6068
+
6069
+ $responseBody = $response->getBody();
6070
+ if ($returnType === '\SplFileObject') {
6071
+ $content = $responseBody; //stream goes to serializer
6072
+ } else {
6073
+ $content = $responseBody->getContents();
6074
+ if ($returnType !== 'string') {
6075
+ $content = json_decode($content);
6076
+ }
6077
+ }
6078
+
6079
+ return [
6080
+ ObjectSerializer::deserialize($content, $returnType, []),
6081
+ $response->getStatusCode(),
6082
+ $response->getHeaders()
6083
+ ];
6084
+
6085
+ } catch (ApiException $e) {
6086
+ switch ($e->getCode()) {
6087
+ case 202:
6088
+ $data = ObjectSerializer::deserialize(
6089
+ $e->getResponseBody(),
6090
+ '\SendinBlue\Client\Model\CreatedProcessId',
6091
+ $e->getResponseHeaders()
6092
+ );
6093
+ $e->setResponseObject($data);
6094
+ break;
6095
+ case 400:
6096
+ $data = ObjectSerializer::deserialize(
6097
+ $e->getResponseBody(),
6098
+ '\SendinBlue\Client\Model\ErrorModel',
6099
+ $e->getResponseHeaders()
6100
+ );
6101
+ $e->setResponseObject($data);
6102
+ break;
6103
+ }
6104
+ throw $e;
6105
+ }
6106
+ }
6107
+
6108
+ /**
6109
+ * Operation requestContactExportAsync
6110
+ *
6111
+ * Export contacts
6112
+ *
6113
+ * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required)
6114
+ *
6115
+ * @throws \InvalidArgumentException
6116
+ * @return \GuzzleHttp\Promise\PromiseInterface
6117
+ */
6118
+ public function requestContactExportAsync($requestContactExport)
6119
+ {
6120
+ return $this->requestContactExportAsyncWithHttpInfo($requestContactExport)
6121
+ ->then(
6122
+ function ($response) {
6123
+ return $response[0];
6124
+ }
6125
+ );
6126
+ }
6127
+
6128
+ /**
6129
+ * Operation requestContactExportAsyncWithHttpInfo
6130
+ *
6131
+ * Export contacts
6132
+ *
6133
+ * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required)
6134
+ *
6135
+ * @throws \InvalidArgumentException
6136
+ * @return \GuzzleHttp\Promise\PromiseInterface
6137
+ */
6138
+ public function requestContactExportAsyncWithHttpInfo($requestContactExport)
6139
+ {
6140
+ $returnType = '\SendinBlue\Client\Model\CreatedProcessId';
6141
+ $request = $this->requestContactExportRequest($requestContactExport);
6142
+
6143
+ return $this->client
6144
+ ->sendAsync($request, $this->createHttpClientOption())
6145
+ ->then(
6146
+ function ($response) use ($returnType) {
6147
+ $responseBody = $response->getBody();
6148
+ if ($returnType === '\SplFileObject') {
6149
+ $content = $responseBody; //stream goes to serializer
6150
+ } else {
6151
+ $content = $responseBody->getContents();
6152
+ if ($returnType !== 'string') {
6153
+ $content = json_decode($content);
6154
+ }
6155
+ }
6156
+
6157
+ return [
6158
+ ObjectSerializer::deserialize($content, $returnType, []),
6159
+ $response->getStatusCode(),
6160
+ $response->getHeaders()
6161
+ ];
6162
+ },
6163
+ function ($exception) {
6164
+ $response = $exception->getResponse();
6165
+ $statusCode = $response->getStatusCode();
6166
+ throw new ApiException(
6167
+ sprintf(
6168
+ '[%d] Error connecting to the API (%s)',
6169
+ $statusCode,
6170
+ $exception->getRequest()->getUri()
6171
+ ),
6172
+ $statusCode,
6173
+ $response->getHeaders(),
6174
+ $response->getBody()
6175
+ );
6176
+ }
6177
+ );
6178
+ }
6179
+
6180
+ /**
6181
+ * Create request for operation 'requestContactExport'
6182
+ *
6183
+ * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required)
6184
+ *
6185
+ * @throws \InvalidArgumentException
6186
+ * @return \GuzzleHttp\Psr7\Request
6187
+ */
6188
+ protected function requestContactExportRequest($requestContactExport)
6189
+ {
6190
+ // verify the required parameter 'requestContactExport' is set
6191
+ if ($requestContactExport === null) {
6192
+ throw new \InvalidArgumentException(
6193
+ 'Missing the required parameter $requestContactExport when calling requestContactExport'
6194
+ );
6195
+ }
6196
+
6197
+ $resourcePath = '/contacts/export';
6198
+ $formParams = [];
6199
+ $queryParams = [];
6200
+ $headerParams = [];
6201
+ $httpBody = '';
6202
+ $multipart = false;
6203
+
6204
+
6205
+
6206
+ // body params
6207
+ $_tempBody = null;
6208
+ if (isset($requestContactExport)) {
6209
+ $_tempBody = $requestContactExport;
6210
+ }
6211
+
6212
+ if ($multipart) {
6213
+ $headers = $this->headerSelector->selectHeadersForMultipart(
6214
+ ['application/json']
6215
+ );
6216
+ } else {
6217
+ $headers = $this->headerSelector->selectHeaders(
6218
+ ['application/json'],
6219
+ ['application/json']
6220
+ );
6221
+ }
6222
+
6223
+ // for model (json/xml)
6224
+ if (isset($_tempBody)) {
6225
+ // $_tempBody is the method argument, if present
6226
+ $httpBody = $_tempBody;
6227
+ // \stdClass has no __toString(), so we should encode it manually
6228
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
6229
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
6230
+ }
6231
+ } elseif (count($formParams) > 0) {
6232
+ if ($multipart) {
6233
+ $multipartContents = [];
6234
+ foreach ($formParams as $formParamName => $formParamValue) {
6235
+ $multipartContents[] = [
6236
+ 'name' => $formParamName,
6237
+ 'contents' => $formParamValue
6238
+ ];
6239
+ }
6240
+ // for HTTP post (form)
6241
+ $httpBody = new MultipartStream($multipartContents);
6242
+
6243
+ } elseif ($headers['Content-Type'] === 'application/json') {
6244
+ $httpBody = \GuzzleHttp\json_encode($formParams);
6245
+
6246
+ } else {
6247
+ // for HTTP post (form)
6248
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
6249
+ }
6250
+ }
6251
+
6252
+ // this endpoint requires API key authentication
6253
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
6254
+ if ($apiKey !== null) {
6255
+ $headers['api-key'] = $apiKey;
6256
+ }
6257
+ // this endpoint requires API key authentication
6258
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
6259
+ if ($apiKey !== null) {
6260
+ $headers['partner-key'] = $apiKey;
6261
+ }
6262
+
6263
+ $defaultHeaders = [];
6264
+ if ($this->config->getUserAgent()) {
6265
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
6266
+ }
6267
+
6268
+ $headers = array_merge(
6269
+ $defaultHeaders,
6270
+ $headerParams,
6271
+ $headers
6272
+ );
6273
+
6274
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
6275
+ return new Request(
6276
+ 'POST',
6277
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
6278
+ $headers,
6279
+ $httpBody
6280
+ );
6281
+ }
6282
+
6283
+ /**
6284
+ * Operation updateAttribute
6285
+ *
6286
+ * Updates contact attribute
6287
+ *
6288
+ * @param string $attributeCategory Category of the attribute (required)
6289
+ * @param string $attributeName Name of the existing attribute (required)
6290
+ * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required)
6291
+ *
6292
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
6293
+ * @throws \InvalidArgumentException
6294
+ * @return void
6295
+ */
6296
+ public function updateAttribute($attributeCategory, $attributeName, $updateAttribute)
6297
+ {
6298
+ $this->updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute);
6299
+ }
6300
+
6301
+ /**
6302
+ * Operation updateAttributeWithHttpInfo
6303
+ *
6304
+ * Updates contact attribute
6305
+ *
6306
+ * @param string $attributeCategory Category of the attribute (required)
6307
+ * @param string $attributeName Name of the existing attribute (required)
6308
+ * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required)
6309
+ *
6310
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
6311
+ * @throws \InvalidArgumentException
6312
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
6313
+ */
6314
+ public function updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute)
6315
+ {
6316
+ $returnType = '';
6317
+ $request = $this->updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute);
6318
+
6319
+ try {
6320
+ $options = $this->createHttpClientOption();
6321
+ try {
6322
+ $response = $this->client->send($request, $options);
6323
+ } catch (RequestException $e) {
6324
+ throw new ApiException(
6325
+ "[{$e->getCode()}] {$e->getMessage()}",
6326
+ $e->getCode(),
6327
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
6328
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
6329
+ );
6330
+ }
6331
+
6332
+ $statusCode = $response->getStatusCode();
6333
+
6334
+ if ($statusCode < 200 || $statusCode > 299) {
6335
+ throw new ApiException(
6336
+ sprintf(
6337
+ '[%d] Error connecting to the API (%s)',
6338
+ $statusCode,
6339
+ $request->getUri()
6340
+ ),
6341
+ $statusCode,
6342
+ $response->getHeaders(),
6343
+ $response->getBody()
6344
+ );
6345
+ }
6346
+
6347
+ return [null, $statusCode, $response->getHeaders()];
6348
+
6349
+ } catch (ApiException $e) {
6350
+ switch ($e->getCode()) {
6351
+ case 400:
6352
+ $data = ObjectSerializer::deserialize(
6353
+ $e->getResponseBody(),
6354
+ '\SendinBlue\Client\Model\ErrorModel',
6355
+ $e->getResponseHeaders()
6356
+ );
6357
+ $e->setResponseObject($data);
6358
+ break;
6359
+ case 404:
6360
+ $data = ObjectSerializer::deserialize(
6361
+ $e->getResponseBody(),
6362
+ '\SendinBlue\Client\Model\ErrorModel',
6363
+ $e->getResponseHeaders()
6364
+ );
6365
+ $e->setResponseObject($data);
6366
+ break;
6367
+ }
6368
+ throw $e;
6369
+ }
6370
+ }
6371
+
6372
+ /**
6373
+ * Operation updateAttributeAsync
6374
+ *
6375
+ * Updates contact attribute
6376
+ *
6377
+ * @param string $attributeCategory Category of the attribute (required)
6378
+ * @param string $attributeName Name of the existing attribute (required)
6379
+ * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required)
6380
+ *
6381
+ * @throws \InvalidArgumentException
6382
+ * @return \GuzzleHttp\Promise\PromiseInterface
6383
+ */
6384
+ public function updateAttributeAsync($attributeCategory, $attributeName, $updateAttribute)
6385
+ {
6386
+ return $this->updateAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $updateAttribute)
6387
+ ->then(
6388
+ function ($response) {
6389
+ return $response[0];
6390
+ }
6391
+ );
6392
+ }
6393
+
6394
+ /**
6395
+ * Operation updateAttributeAsyncWithHttpInfo
6396
+ *
6397
+ * Updates contact attribute
6398
+ *
6399
+ * @param string $attributeCategory Category of the attribute (required)
6400
+ * @param string $attributeName Name of the existing attribute (required)
6401
+ * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required)
6402
+ *
6403
+ * @throws \InvalidArgumentException
6404
+ * @return \GuzzleHttp\Promise\PromiseInterface
6405
+ */
6406
+ public function updateAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $updateAttribute)
6407
+ {
6408
+ $returnType = '';
6409
+ $request = $this->updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute);
6410
+
6411
+ return $this->client
6412
+ ->sendAsync($request, $this->createHttpClientOption())
6413
+ ->then(
6414
+ function ($response) use ($returnType) {
6415
+ return [null, $response->getStatusCode(), $response->getHeaders()];
6416
+ },
6417
+ function ($exception) {
6418
+ $response = $exception->getResponse();
6419
+ $statusCode = $response->getStatusCode();
6420
+ throw new ApiException(
6421
+ sprintf(
6422
+ '[%d] Error connecting to the API (%s)',
6423
+ $statusCode,
6424
+ $exception->getRequest()->getUri()
6425
+ ),
6426
+ $statusCode,
6427
+ $response->getHeaders(),
6428
+ $response->getBody()
6429
+ );
6430
+ }
6431
+ );
6432
+ }
6433
+
6434
+ /**
6435
+ * Create request for operation 'updateAttribute'
6436
+ *
6437
+ * @param string $attributeCategory Category of the attribute (required)
6438
+ * @param string $attributeName Name of the existing attribute (required)
6439
+ * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required)
6440
+ *
6441
+ * @throws \InvalidArgumentException
6442
+ * @return \GuzzleHttp\Psr7\Request
6443
+ */
6444
+ protected function updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute)
6445
+ {
6446
+ // verify the required parameter 'attributeCategory' is set
6447
+ if ($attributeCategory === null) {
6448
+ throw new \InvalidArgumentException(
6449
+ 'Missing the required parameter $attributeCategory when calling updateAttribute'
6450
+ );
6451
+ }
6452
+ // verify the required parameter 'attributeName' is set
6453
+ if ($attributeName === null) {
6454
+ throw new \InvalidArgumentException(
6455
+ 'Missing the required parameter $attributeName when calling updateAttribute'
6456
+ );
6457
+ }
6458
+ // verify the required parameter 'updateAttribute' is set
6459
+ if ($updateAttribute === null) {
6460
+ throw new \InvalidArgumentException(
6461
+ 'Missing the required parameter $updateAttribute when calling updateAttribute'
6462
+ );
6463
+ }
6464
+
6465
+ $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}';
6466
+ $formParams = [];
6467
+ $queryParams = [];
6468
+ $headerParams = [];
6469
+ $httpBody = '';
6470
+ $multipart = false;
6471
+
6472
+
6473
+ // path params
6474
+ if ($attributeCategory !== null) {
6475
+ $resourcePath = str_replace(
6476
+ '{' . 'attributeCategory' . '}',
6477
+ ObjectSerializer::toPathValue($attributeCategory),
6478
+ $resourcePath
6479
+ );
6480
+ }
6481
+ // path params
6482
+ if ($attributeName !== null) {
6483
+ $resourcePath = str_replace(
6484
+ '{' . 'attributeName' . '}',
6485
+ ObjectSerializer::toPathValue($attributeName),
6486
+ $resourcePath
6487
+ );
6488
+ }
6489
+
6490
+ // body params
6491
+ $_tempBody = null;
6492
+ if (isset($updateAttribute)) {
6493
+ $_tempBody = $updateAttribute;
6494
+ }
6495
+
6496
+ if ($multipart) {
6497
+ $headers = $this->headerSelector->selectHeadersForMultipart(
6498
+ ['application/json']
6499
+ );
6500
+ } else {
6501
+ $headers = $this->headerSelector->selectHeaders(
6502
+ ['application/json'],
6503
+ ['application/json']
6504
+ );
6505
+ }
6506
+
6507
+ // for model (json/xml)
6508
+ if (isset($_tempBody)) {
6509
+ // $_tempBody is the method argument, if present
6510
+ $httpBody = $_tempBody;
6511
+ // \stdClass has no __toString(), so we should encode it manually
6512
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
6513
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
6514
+ }
6515
+ } elseif (count($formParams) > 0) {
6516
+ if ($multipart) {
6517
+ $multipartContents = [];
6518
+ foreach ($formParams as $formParamName => $formParamValue) {
6519
+ $multipartContents[] = [
6520
+ 'name' => $formParamName,
6521
+ 'contents' => $formParamValue
6522
+ ];
6523
+ }
6524
+ // for HTTP post (form)
6525
+ $httpBody = new MultipartStream($multipartContents);
6526
+
6527
+ } elseif ($headers['Content-Type'] === 'application/json') {
6528
+ $httpBody = \GuzzleHttp\json_encode($formParams);
6529
+
6530
+ } else {
6531
+ // for HTTP post (form)
6532
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
6533
+ }
6534
+ }
6535
+
6536
+ // this endpoint requires API key authentication
6537
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
6538
+ if ($apiKey !== null) {
6539
+ $headers['api-key'] = $apiKey;
6540
+ }
6541
+ // this endpoint requires API key authentication
6542
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
6543
+ if ($apiKey !== null) {
6544
+ $headers['partner-key'] = $apiKey;
6545
+ }
6546
+
6547
+ $defaultHeaders = [];
6548
+ if ($this->config->getUserAgent()) {
6549
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
6550
+ }
6551
+
6552
+ $headers = array_merge(
6553
+ $defaultHeaders,
6554
+ $headerParams,
6555
+ $headers
6556
+ );
6557
+
6558
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
6559
+ return new Request(
6560
+ 'PUT',
6561
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
6562
+ $headers,
6563
+ $httpBody
6564
+ );
6565
+ }
6566
+
6567
+ /**
6568
+ * Operation updateContact
6569
+ *
6570
+ * Updates a contact
6571
+ *
6572
+ * @param string $email Email (urlencoded) of the contact (required)
6573
+ * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required)
6574
+ *
6575
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
6576
+ * @throws \InvalidArgumentException
6577
+ * @return void
6578
+ */
6579
+ public function updateContact($email, $updateContact)
6580
+ {
6581
+ $this->updateContactWithHttpInfo($email, $updateContact);
6582
+ }
6583
+
6584
+ /**
6585
+ * Operation updateContactWithHttpInfo
6586
+ *
6587
+ * Updates a contact
6588
+ *
6589
+ * @param string $email Email (urlencoded) of the contact (required)
6590
+ * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required)
6591
+ *
6592
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
6593
+ * @throws \InvalidArgumentException
6594
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
6595
+ */
6596
+ public function updateContactWithHttpInfo($email, $updateContact)
6597
+ {
6598
+ $returnType = '';
6599
+ $request = $this->updateContactRequest($email, $updateContact);
6600
+
6601
+ try {
6602
+ $options = $this->createHttpClientOption();
6603
+ try {
6604
+ $response = $this->client->send($request, $options);
6605
+ } catch (RequestException $e) {
6606
+ throw new ApiException(
6607
+ "[{$e->getCode()}] {$e->getMessage()}",
6608
+ $e->getCode(),
6609
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
6610
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
6611
+ );
6612
+ }
6613
+
6614
+ $statusCode = $response->getStatusCode();
6615
+
6616
+ if ($statusCode < 200 || $statusCode > 299) {
6617
+ throw new ApiException(
6618
+ sprintf(
6619
+ '[%d] Error connecting to the API (%s)',
6620
+ $statusCode,
6621
+ $request->getUri()
6622
+ ),
6623
+ $statusCode,
6624
+ $response->getHeaders(),
6625
+ $response->getBody()
6626
+ );
6627
+ }
6628
+
6629
+ return [null, $statusCode, $response->getHeaders()];
6630
+
6631
+ } catch (ApiException $e) {
6632
+ switch ($e->getCode()) {
6633
+ case 400:
6634
+ $data = ObjectSerializer::deserialize(
6635
+ $e->getResponseBody(),
6636
+ '\SendinBlue\Client\Model\ErrorModel',
6637
+ $e->getResponseHeaders()
6638
+ );
6639
+ $e->setResponseObject($data);
6640
+ break;
6641
+ case 404:
6642
+ $data = ObjectSerializer::deserialize(
6643
+ $e->getResponseBody(),
6644
+ '\SendinBlue\Client\Model\ErrorModel',
6645
+ $e->getResponseHeaders()
6646
+ );
6647
+ $e->setResponseObject($data);
6648
+ break;
6649
+ }
6650
+ throw $e;
6651
+ }
6652
+ }
6653
+
6654
+ /**
6655
+ * Operation updateContactAsync
6656
+ *
6657
+ * Updates a contact
6658
+ *
6659
+ * @param string $email Email (urlencoded) of the contact (required)
6660
+ * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required)
6661
+ *
6662
+ * @throws \InvalidArgumentException
6663
+ * @return \GuzzleHttp\Promise\PromiseInterface
6664
+ */
6665
+ public function updateContactAsync($email, $updateContact)
6666
+ {
6667
+ return $this->updateContactAsyncWithHttpInfo($email, $updateContact)
6668
+ ->then(
6669
+ function ($response) {
6670
+ return $response[0];
6671
+ }
6672
+ );
6673
+ }
6674
+
6675
+ /**
6676
+ * Operation updateContactAsyncWithHttpInfo
6677
+ *
6678
+ * Updates a contact
6679
+ *
6680
+ * @param string $email Email (urlencoded) of the contact (required)
6681
+ * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required)
6682
+ *
6683
+ * @throws \InvalidArgumentException
6684
+ * @return \GuzzleHttp\Promise\PromiseInterface
6685
+ */
6686
+ public function updateContactAsyncWithHttpInfo($email, $updateContact)
6687
+ {
6688
+ $returnType = '';
6689
+ $request = $this->updateContactRequest($email, $updateContact);
6690
+
6691
+ return $this->client
6692
+ ->sendAsync($request, $this->createHttpClientOption())
6693
+ ->then(
6694
+ function ($response) use ($returnType) {
6695
+ return [null, $response->getStatusCode(), $response->getHeaders()];
6696
+ },
6697
+ function ($exception) {
6698
+ $response = $exception->getResponse();
6699
+ $statusCode = $response->getStatusCode();
6700
+ throw new ApiException(
6701
+ sprintf(
6702
+ '[%d] Error connecting to the API (%s)',
6703
+ $statusCode,
6704
+ $exception->getRequest()->getUri()
6705
+ ),
6706
+ $statusCode,
6707
+ $response->getHeaders(),
6708
+ $response->getBody()
6709
+ );
6710
+ }
6711
+ );
6712
+ }
6713
+
6714
+ /**
6715
+ * Create request for operation 'updateContact'
6716
+ *
6717
+ * @param string $email Email (urlencoded) of the contact (required)
6718
+ * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required)
6719
+ *
6720
+ * @throws \InvalidArgumentException
6721
+ * @return \GuzzleHttp\Psr7\Request
6722
+ */
6723
+ protected function updateContactRequest($email, $updateContact)
6724
+ {
6725
+ // verify the required parameter 'email' is set
6726
+ if ($email === null) {
6727
+ throw new \InvalidArgumentException(
6728
+ 'Missing the required parameter $email when calling updateContact'
6729
+ );
6730
+ }
6731
+ // verify the required parameter 'updateContact' is set
6732
+ if ($updateContact === null) {
6733
+ throw new \InvalidArgumentException(
6734
+ 'Missing the required parameter $updateContact when calling updateContact'
6735
+ );
6736
+ }
6737
+
6738
+ $resourcePath = '/contacts/{email}';
6739
+ $formParams = [];
6740
+ $queryParams = [];
6741
+ $headerParams = [];
6742
+ $httpBody = '';
6743
+ $multipart = false;
6744
+
6745
+
6746
+ // path params
6747
+ if ($email !== null) {
6748
+ $resourcePath = str_replace(
6749
+ '{' . 'email' . '}',
6750
+ ObjectSerializer::toPathValue($email),
6751
+ $resourcePath
6752
+ );
6753
+ }
6754
+
6755
+ // body params
6756
+ $_tempBody = null;
6757
+ if (isset($updateContact)) {
6758
+ $_tempBody = $updateContact;
6759
+ }
6760
+
6761
+ if ($multipart) {
6762
+ $headers = $this->headerSelector->selectHeadersForMultipart(
6763
+ ['application/json']
6764
+ );
6765
+ } else {
6766
+ $headers = $this->headerSelector->selectHeaders(
6767
+ ['application/json'],
6768
+ ['application/json']
6769
+ );
6770
+ }
6771
+
6772
+ // for model (json/xml)
6773
+ if (isset($_tempBody)) {
6774
+ // $_tempBody is the method argument, if present
6775
+ $httpBody = $_tempBody;
6776
+ // \stdClass has no __toString(), so we should encode it manually
6777
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
6778
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
6779
+ }
6780
+ } elseif (count($formParams) > 0) {
6781
+ if ($multipart) {
6782
+ $multipartContents = [];
6783
+ foreach ($formParams as $formParamName => $formParamValue) {
6784
+ $multipartContents[] = [
6785
+ 'name' => $formParamName,
6786
+ 'contents' => $formParamValue
6787
+ ];
6788
+ }
6789
+ // for HTTP post (form)
6790
+ $httpBody = new MultipartStream($multipartContents);
6791
+
6792
+ } elseif ($headers['Content-Type'] === 'application/json') {
6793
+ $httpBody = \GuzzleHttp\json_encode($formParams);
6794
+
6795
+ } else {
6796
+ // for HTTP post (form)
6797
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
6798
+ }
6799
+ }
6800
+
6801
+ // this endpoint requires API key authentication
6802
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
6803
+ if ($apiKey !== null) {
6804
+ $headers['api-key'] = $apiKey;
6805
+ }
6806
+ // this endpoint requires API key authentication
6807
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
6808
+ if ($apiKey !== null) {
6809
+ $headers['partner-key'] = $apiKey;
6810
+ }
6811
+
6812
+ $defaultHeaders = [];
6813
+ if ($this->config->getUserAgent()) {
6814
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
6815
+ }
6816
+
6817
+ $headers = array_merge(
6818
+ $defaultHeaders,
6819
+ $headerParams,
6820
+ $headers
6821
+ );
6822
+
6823
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
6824
+ return new Request(
6825
+ 'PUT',
6826
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
6827
+ $headers,
6828
+ $httpBody
6829
+ );
6830
+ }
6831
+
6832
+ /**
6833
+ * Operation updateFolder
6834
+ *
6835
+ * Update a contact folder
6836
+ *
6837
+ * @param int $folderId Id of the folder (required)
6838
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required)
6839
+ *
6840
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
6841
+ * @throws \InvalidArgumentException
6842
+ * @return void
6843
+ */
6844
+ public function updateFolder($folderId, $updateFolder)
6845
+ {
6846
+ $this->updateFolderWithHttpInfo($folderId, $updateFolder);
6847
+ }
6848
+
6849
+ /**
6850
+ * Operation updateFolderWithHttpInfo
6851
+ *
6852
+ * Update a contact folder
6853
+ *
6854
+ * @param int $folderId Id of the folder (required)
6855
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required)
6856
+ *
6857
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
6858
+ * @throws \InvalidArgumentException
6859
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
6860
+ */
6861
+ public function updateFolderWithHttpInfo($folderId, $updateFolder)
6862
+ {
6863
+ $returnType = '';
6864
+ $request = $this->updateFolderRequest($folderId, $updateFolder);
6865
+
6866
+ try {
6867
+ $options = $this->createHttpClientOption();
6868
+ try {
6869
+ $response = $this->client->send($request, $options);
6870
+ } catch (RequestException $e) {
6871
+ throw new ApiException(
6872
+ "[{$e->getCode()}] {$e->getMessage()}",
6873
+ $e->getCode(),
6874
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
6875
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
6876
+ );
6877
+ }
6878
+
6879
+ $statusCode = $response->getStatusCode();
6880
+
6881
+ if ($statusCode < 200 || $statusCode > 299) {
6882
+ throw new ApiException(
6883
+ sprintf(
6884
+ '[%d] Error connecting to the API (%s)',
6885
+ $statusCode,
6886
+ $request->getUri()
6887
+ ),
6888
+ $statusCode,
6889
+ $response->getHeaders(),
6890
+ $response->getBody()
6891
+ );
6892
+ }
6893
+
6894
+ return [null, $statusCode, $response->getHeaders()];
6895
+
6896
+ } catch (ApiException $e) {
6897
+ switch ($e->getCode()) {
6898
+ case 400:
6899
+ $data = ObjectSerializer::deserialize(
6900
+ $e->getResponseBody(),
6901
+ '\SendinBlue\Client\Model\ErrorModel',
6902
+ $e->getResponseHeaders()
6903
+ );
6904
+ $e->setResponseObject($data);
6905
+ break;
6906
+ case 404:
6907
+ $data = ObjectSerializer::deserialize(
6908
+ $e->getResponseBody(),
6909
+ '\SendinBlue\Client\Model\ErrorModel',
6910
+ $e->getResponseHeaders()
6911
+ );
6912
+ $e->setResponseObject($data);
6913
+ break;
6914
+ }
6915
+ throw $e;
6916
+ }
6917
+ }
6918
+
6919
+ /**
6920
+ * Operation updateFolderAsync
6921
+ *
6922
+ * Update a contact folder
6923
+ *
6924
+ * @param int $folderId Id of the folder (required)
6925
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required)
6926
+ *
6927
+ * @throws \InvalidArgumentException
6928
+ * @return \GuzzleHttp\Promise\PromiseInterface
6929
+ */
6930
+ public function updateFolderAsync($folderId, $updateFolder)
6931
+ {
6932
+ return $this->updateFolderAsyncWithHttpInfo($folderId, $updateFolder)
6933
+ ->then(
6934
+ function ($response) {
6935
+ return $response[0];
6936
+ }
6937
+ );
6938
+ }
6939
+
6940
+ /**
6941
+ * Operation updateFolderAsyncWithHttpInfo
6942
+ *
6943
+ * Update a contact folder
6944
+ *
6945
+ * @param int $folderId Id of the folder (required)
6946
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required)
6947
+ *
6948
+ * @throws \InvalidArgumentException
6949
+ * @return \GuzzleHttp\Promise\PromiseInterface
6950
+ */
6951
+ public function updateFolderAsyncWithHttpInfo($folderId, $updateFolder)
6952
+ {
6953
+ $returnType = '';
6954
+ $request = $this->updateFolderRequest($folderId, $updateFolder);
6955
+
6956
+ return $this->client
6957
+ ->sendAsync($request, $this->createHttpClientOption())
6958
+ ->then(
6959
+ function ($response) use ($returnType) {
6960
+ return [null, $response->getStatusCode(), $response->getHeaders()];
6961
+ },
6962
+ function ($exception) {
6963
+ $response = $exception->getResponse();
6964
+ $statusCode = $response->getStatusCode();
6965
+ throw new ApiException(
6966
+ sprintf(
6967
+ '[%d] Error connecting to the API (%s)',
6968
+ $statusCode,
6969
+ $exception->getRequest()->getUri()
6970
+ ),
6971
+ $statusCode,
6972
+ $response->getHeaders(),
6973
+ $response->getBody()
6974
+ );
6975
+ }
6976
+ );
6977
+ }
6978
+
6979
+ /**
6980
+ * Create request for operation 'updateFolder'
6981
+ *
6982
+ * @param int $folderId Id of the folder (required)
6983
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required)
6984
+ *
6985
+ * @throws \InvalidArgumentException
6986
+ * @return \GuzzleHttp\Psr7\Request
6987
+ */
6988
+ protected function updateFolderRequest($folderId, $updateFolder)
6989
+ {
6990
+ // verify the required parameter 'folderId' is set
6991
+ if ($folderId === null) {
6992
+ throw new \InvalidArgumentException(
6993
+ 'Missing the required parameter $folderId when calling updateFolder'
6994
+ );
6995
+ }
6996
+ // verify the required parameter 'updateFolder' is set
6997
+ if ($updateFolder === null) {
6998
+ throw new \InvalidArgumentException(
6999
+ 'Missing the required parameter $updateFolder when calling updateFolder'
7000
+ );
7001
+ }
7002
+
7003
+ $resourcePath = '/contacts/folders/{folderId}';
7004
+ $formParams = [];
7005
+ $queryParams = [];
7006
+ $headerParams = [];
7007
+ $httpBody = '';
7008
+ $multipart = false;
7009
+
7010
+
7011
+ // path params
7012
+ if ($folderId !== null) {
7013
+ $resourcePath = str_replace(
7014
+ '{' . 'folderId' . '}',
7015
+ ObjectSerializer::toPathValue($folderId),
7016
+ $resourcePath
7017
+ );
7018
+ }
7019
+
7020
+ // body params
7021
+ $_tempBody = null;
7022
+ if (isset($updateFolder)) {
7023
+ $_tempBody = $updateFolder;
7024
+ }
7025
+
7026
+ if ($multipart) {
7027
+ $headers = $this->headerSelector->selectHeadersForMultipart(
7028
+ ['application/json']
7029
+ );
7030
+ } else {
7031
+ $headers = $this->headerSelector->selectHeaders(
7032
+ ['application/json'],
7033
+ ['application/json']
7034
+ );
7035
+ }
7036
+
7037
+ // for model (json/xml)
7038
+ if (isset($_tempBody)) {
7039
+ // $_tempBody is the method argument, if present
7040
+ $httpBody = $_tempBody;
7041
+ // \stdClass has no __toString(), so we should encode it manually
7042
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
7043
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
7044
+ }
7045
+ } elseif (count($formParams) > 0) {
7046
+ if ($multipart) {
7047
+ $multipartContents = [];
7048
+ foreach ($formParams as $formParamName => $formParamValue) {
7049
+ $multipartContents[] = [
7050
+ 'name' => $formParamName,
7051
+ 'contents' => $formParamValue
7052
+ ];
7053
+ }
7054
+ // for HTTP post (form)
7055
+ $httpBody = new MultipartStream($multipartContents);
7056
+
7057
+ } elseif ($headers['Content-Type'] === 'application/json') {
7058
+ $httpBody = \GuzzleHttp\json_encode($formParams);
7059
+
7060
+ } else {
7061
+ // for HTTP post (form)
7062
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
7063
+ }
7064
+ }
7065
+
7066
+ // this endpoint requires API key authentication
7067
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
7068
+ if ($apiKey !== null) {
7069
+ $headers['api-key'] = $apiKey;
7070
+ }
7071
+ // this endpoint requires API key authentication
7072
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
7073
+ if ($apiKey !== null) {
7074
+ $headers['partner-key'] = $apiKey;
7075
+ }
7076
+
7077
+ $defaultHeaders = [];
7078
+ if ($this->config->getUserAgent()) {
7079
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
7080
+ }
7081
+
7082
+ $headers = array_merge(
7083
+ $defaultHeaders,
7084
+ $headerParams,
7085
+ $headers
7086
+ );
7087
+
7088
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
7089
+ return new Request(
7090
+ 'PUT',
7091
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
7092
+ $headers,
7093
+ $httpBody
7094
+ );
7095
+ }
7096
+
7097
+ /**
7098
+ * Operation updateList
7099
+ *
7100
+ * Update a list
7101
+ *
7102
+ * @param int $listId Id of the list (required)
7103
+ * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required)
7104
+ *
7105
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
7106
+ * @throws \InvalidArgumentException
7107
+ * @return void
7108
+ */
7109
+ public function updateList($listId, $updateList)
7110
+ {
7111
+ $this->updateListWithHttpInfo($listId, $updateList);
7112
+ }
7113
+
7114
+ /**
7115
+ * Operation updateListWithHttpInfo
7116
+ *
7117
+ * Update a list
7118
+ *
7119
+ * @param int $listId Id of the list (required)
7120
+ * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required)
7121
+ *
7122
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
7123
+ * @throws \InvalidArgumentException
7124
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
7125
+ */
7126
+ public function updateListWithHttpInfo($listId, $updateList)
7127
+ {
7128
+ $returnType = '';
7129
+ $request = $this->updateListRequest($listId, $updateList);
7130
+
7131
+ try {
7132
+ $options = $this->createHttpClientOption();
7133
+ try {
7134
+ $response = $this->client->send($request, $options);
7135
+ } catch (RequestException $e) {
7136
+ throw new ApiException(
7137
+ "[{$e->getCode()}] {$e->getMessage()}",
7138
+ $e->getCode(),
7139
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
7140
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
7141
+ );
7142
+ }
7143
+
7144
+ $statusCode = $response->getStatusCode();
7145
+
7146
+ if ($statusCode < 200 || $statusCode > 299) {
7147
+ throw new ApiException(
7148
+ sprintf(
7149
+ '[%d] Error connecting to the API (%s)',
7150
+ $statusCode,
7151
+ $request->getUri()
7152
+ ),
7153
+ $statusCode,
7154
+ $response->getHeaders(),
7155
+ $response->getBody()
7156
+ );
7157
+ }
7158
+
7159
+ return [null, $statusCode, $response->getHeaders()];
7160
+
7161
+ } catch (ApiException $e) {
7162
+ switch ($e->getCode()) {
7163
+ case 400:
7164
+ $data = ObjectSerializer::deserialize(
7165
+ $e->getResponseBody(),
7166
+ '\SendinBlue\Client\Model\ErrorModel',
7167
+ $e->getResponseHeaders()
7168
+ );
7169
+ $e->setResponseObject($data);
7170
+ break;
7171
+ case 404:
7172
+ $data = ObjectSerializer::deserialize(
7173
+ $e->getResponseBody(),
7174
+ '\SendinBlue\Client\Model\ErrorModel',
7175
+ $e->getResponseHeaders()
7176
+ );
7177
+ $e->setResponseObject($data);
7178
+ break;
7179
+ }
7180
+ throw $e;
7181
+ }
7182
+ }
7183
+
7184
+ /**
7185
+ * Operation updateListAsync
7186
+ *
7187
+ * Update a list
7188
+ *
7189
+ * @param int $listId Id of the list (required)
7190
+ * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required)
7191
+ *
7192
+ * @throws \InvalidArgumentException
7193
+ * @return \GuzzleHttp\Promise\PromiseInterface
7194
+ */
7195
+ public function updateListAsync($listId, $updateList)
7196
+ {
7197
+ return $this->updateListAsyncWithHttpInfo($listId, $updateList)
7198
+ ->then(
7199
+ function ($response) {
7200
+ return $response[0];
7201
+ }
7202
+ );
7203
+ }
7204
+
7205
+ /**
7206
+ * Operation updateListAsyncWithHttpInfo
7207
+ *
7208
+ * Update a list
7209
+ *
7210
+ * @param int $listId Id of the list (required)
7211
+ * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required)
7212
+ *
7213
+ * @throws \InvalidArgumentException
7214
+ * @return \GuzzleHttp\Promise\PromiseInterface
7215
+ */
7216
+ public function updateListAsyncWithHttpInfo($listId, $updateList)
7217
+ {
7218
+ $returnType = '';
7219
+ $request = $this->updateListRequest($listId, $updateList);
7220
+
7221
+ return $this->client
7222
+ ->sendAsync($request, $this->createHttpClientOption())
7223
+ ->then(
7224
+ function ($response) use ($returnType) {
7225
+ return [null, $response->getStatusCode(), $response->getHeaders()];
7226
+ },
7227
+ function ($exception) {
7228
+ $response = $exception->getResponse();
7229
+ $statusCode = $response->getStatusCode();
7230
+ throw new ApiException(
7231
+ sprintf(
7232
+ '[%d] Error connecting to the API (%s)',
7233
+ $statusCode,
7234
+ $exception->getRequest()->getUri()
7235
+ ),
7236
+ $statusCode,
7237
+ $response->getHeaders(),
7238
+ $response->getBody()
7239
+ );
7240
+ }
7241
+ );
7242
+ }
7243
+
7244
+ /**
7245
+ * Create request for operation 'updateList'
7246
+ *
7247
+ * @param int $listId Id of the list (required)
7248
+ * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required)
7249
+ *
7250
+ * @throws \InvalidArgumentException
7251
+ * @return \GuzzleHttp\Psr7\Request
7252
+ */
7253
+ protected function updateListRequest($listId, $updateList)
7254
+ {
7255
+ // verify the required parameter 'listId' is set
7256
+ if ($listId === null) {
7257
+ throw new \InvalidArgumentException(
7258
+ 'Missing the required parameter $listId when calling updateList'
7259
+ );
7260
+ }
7261
+ // verify the required parameter 'updateList' is set
7262
+ if ($updateList === null) {
7263
+ throw new \InvalidArgumentException(
7264
+ 'Missing the required parameter $updateList when calling updateList'
7265
+ );
7266
+ }
7267
+
7268
+ $resourcePath = '/contacts/lists/{listId}';
7269
+ $formParams = [];
7270
+ $queryParams = [];
7271
+ $headerParams = [];
7272
+ $httpBody = '';
7273
+ $multipart = false;
7274
+
7275
+
7276
+ // path params
7277
+ if ($listId !== null) {
7278
+ $resourcePath = str_replace(
7279
+ '{' . 'listId' . '}',
7280
+ ObjectSerializer::toPathValue($listId),
7281
+ $resourcePath
7282
+ );
7283
+ }
7284
+
7285
+ // body params
7286
+ $_tempBody = null;
7287
+ if (isset($updateList)) {
7288
+ $_tempBody = $updateList;
7289
+ }
7290
+
7291
+ if ($multipart) {
7292
+ $headers = $this->headerSelector->selectHeadersForMultipart(
7293
+ ['application/json']
7294
+ );
7295
+ } else {
7296
+ $headers = $this->headerSelector->selectHeaders(
7297
+ ['application/json'],
7298
+ ['application/json']
7299
+ );
7300
+ }
7301
+
7302
+ // for model (json/xml)
7303
+ if (isset($_tempBody)) {
7304
+ // $_tempBody is the method argument, if present
7305
+ $httpBody = $_tempBody;
7306
+ // \stdClass has no __toString(), so we should encode it manually
7307
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
7308
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
7309
+ }
7310
+ } elseif (count($formParams) > 0) {
7311
+ if ($multipart) {
7312
+ $multipartContents = [];
7313
+ foreach ($formParams as $formParamName => $formParamValue) {
7314
+ $multipartContents[] = [
7315
+ 'name' => $formParamName,
7316
+ 'contents' => $formParamValue
7317
+ ];
7318
+ }
7319
+ // for HTTP post (form)
7320
+ $httpBody = new MultipartStream($multipartContents);
7321
+
7322
+ } elseif ($headers['Content-Type'] === 'application/json') {
7323
+ $httpBody = \GuzzleHttp\json_encode($formParams);
7324
+
7325
+ } else {
7326
+ // for HTTP post (form)
7327
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
7328
+ }
7329
+ }
7330
+
7331
+ // this endpoint requires API key authentication
7332
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
7333
+ if ($apiKey !== null) {
7334
+ $headers['api-key'] = $apiKey;
7335
+ }
7336
+ // this endpoint requires API key authentication
7337
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
7338
+ if ($apiKey !== null) {
7339
+ $headers['partner-key'] = $apiKey;
7340
+ }
7341
+
7342
+ $defaultHeaders = [];
7343
+ if ($this->config->getUserAgent()) {
7344
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
7345
+ }
7346
+
7347
+ $headers = array_merge(
7348
+ $defaultHeaders,
7349
+ $headerParams,
7350
+ $headers
7351
+ );
7352
+
7353
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
7354
+ return new Request(
7355
+ 'PUT',
7356
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
7357
+ $headers,
7358
+ $httpBody
7359
+ );
7360
+ }
7361
+
7362
+ /**
7363
+ * Create http client option
7364
+ *
7365
+ * @throws \RuntimeException on file opening failure
7366
+ * @return array of http client options
7367
+ */
7368
+ protected function createHttpClientOption()
7369
+ {
7370
+ $options = [];
7371
+ if ($this->config->getDebug()) {
7372
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
7373
+ if (!$options[RequestOptions::DEBUG]) {
7374
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
7375
+ }
7376
+ }
7377
+
7378
+ return $options;
7379
+ }
7380
+ }
vendor/sendinblue/api-v3-sdk/lib/Api/EmailCampaignsApi.php ADDED
@@ -0,0 +1,2851 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * EmailCampaignsApi
4
+ * PHP version 5
5
+ *
6
+ * @category Class
7
+ * @package SendinBlue\Client
8
+ * @author Swagger Codegen team
9
+ * @link https://github.com/swagger-api/swagger-codegen
10
+ */
11
+
12
+ /**
13
+ * SendinBlue API
14
+ *
15
+ * SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
16
+ *
17
+ * OpenAPI spec version: 3.0.0
18
+ * Contact: contact@sendinblue.com
19
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
20
+ * Swagger Codegen version: 2.3.1
21
+ */
22
+
23
+ /**
24
+ * NOTE: This class is auto generated by the swagger code generator program.
25
+ * https://github.com/swagger-api/swagger-codegen
26
+ * Do not edit the class manually.
27
+ */
28
+
29
+ namespace SendinBlue\Client\Api;
30
+
31
+ use GuzzleHttp\Client;
32
+ use GuzzleHttp\ClientInterface;
33
+ use GuzzleHttp\Exception\RequestException;
34
+ use GuzzleHttp\Psr7\MultipartStream;
35
+ use GuzzleHttp\Psr7\Request;
36
+ use GuzzleHttp\RequestOptions;
37
+ use SendinBlue\Client\ApiException;
38
+ use SendinBlue\Client\Configuration;
39
+ use SendinBlue\Client\HeaderSelector;
40
+ use SendinBlue\Client\ObjectSerializer;
41
+
42
+ /**
43
+ * EmailCampaignsApi Class Doc Comment
44
+ *
45
+ * @category Class
46
+ * @package SendinBlue\Client
47
+ * @author Swagger Codegen team
48
+ * @link https://github.com/swagger-api/swagger-codegen
49
+ */
50
+ class EmailCampaignsApi
51
+ {
52
+ /**
53
+ * @var ClientInterface
54
+ */
55
+ protected $client;
56
+
57
+ /**
58
+ * @var Configuration
59
+ */
60
+ protected $config;
61
+
62
+ /**
63
+ * @param ClientInterface $client
64
+ * @param Configuration $config
65
+ * @param HeaderSelector $selector
66
+ */
67
+ public function __construct(
68
+ ClientInterface $client = null,
69
+ Configuration $config = null,
70
+ HeaderSelector $selector = null
71
+ ) {
72
+ $this->client = $client ?: new Client();
73
+ $this->config = $config ?: new Configuration();
74
+ $this->headerSelector = $selector ?: new HeaderSelector();
75
+ }
76
+
77
+ /**
78
+ * @return Configuration
79
+ */
80
+ public function getConfig()
81
+ {
82
+ return $this->config;
83
+ }
84
+
85
+ /**
86
+ * Operation createEmailCampaign
87
+ *
88
+ * Create an email campaign
89
+ *
90
+ * @param \SendinBlue\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required)
91
+ *
92
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
93
+ * @throws \InvalidArgumentException
94
+ * @return \SendinBlue\Client\Model\CreateModel
95
+ */
96
+ public function createEmailCampaign($emailCampaigns)
97
+ {
98
+ list($response) = $this->createEmailCampaignWithHttpInfo($emailCampaigns);
99
+ return $response;
100
+ }
101
+
102
+ /**
103
+ * Operation createEmailCampaignWithHttpInfo
104
+ *
105
+ * Create an email campaign
106
+ *
107
+ * @param \SendinBlue\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required)
108
+ *
109
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
110
+ * @throws \InvalidArgumentException
111
+ * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings)
112
+ */
113
+ public function createEmailCampaignWithHttpInfo($emailCampaigns)
114
+ {
115
+ $returnType = '\SendinBlue\Client\Model\CreateModel';
116
+ $request = $this->createEmailCampaignRequest($emailCampaigns);
117
+
118
+ try {
119
+ $options = $this->createHttpClientOption();
120
+ try {
121
+ $response = $this->client->send($request, $options);
122
+ } catch (RequestException $e) {
123
+ throw new ApiException(
124
+ "[{$e->getCode()}] {$e->getMessage()}",
125
+ $e->getCode(),
126
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
127
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
128
+ );
129
+ }
130
+
131
+ $statusCode = $response->getStatusCode();
132
+
133
+ if ($statusCode < 200 || $statusCode > 299) {
134
+ throw new ApiException(
135
+ sprintf(
136
+ '[%d] Error connecting to the API (%s)',
137
+ $statusCode,
138
+ $request->getUri()
139
+ ),
140
+ $statusCode,
141
+ $response->getHeaders(),
142
+ $response->getBody()
143
+ );
144
+ }
145
+
146
+ $responseBody = $response->getBody();
147
+ if ($returnType === '\SplFileObject') {
148
+ $content = $responseBody; //stream goes to serializer
149
+ } else {
150
+ $content = $responseBody->getContents();
151
+ if ($returnType !== 'string') {
152
+ $content = json_decode($content);
153
+ }
154
+ }
155
+
156
+ return [
157
+ ObjectSerializer::deserialize($content, $returnType, []),
158
+ $response->getStatusCode(),
159
+ $response->getHeaders()
160
+ ];
161
+
162
+ } catch (ApiException $e) {
163
+ switch ($e->getCode()) {
164
+ case 201:
165
+ $data = ObjectSerializer::deserialize(
166
+ $e->getResponseBody(),
167
+ '\SendinBlue\Client\Model\CreateModel',
168
+ $e->getResponseHeaders()
169
+ );
170
+ $e->setResponseObject($data);
171
+ break;
172
+ case 400:
173
+ $data = ObjectSerializer::deserialize(
174
+ $e->getResponseBody(),
175
+ '\SendinBlue\Client\Model\ErrorModel',
176
+ $e->getResponseHeaders()
177
+ );
178
+ $e->setResponseObject($data);
179
+ break;
180
+ }
181
+ throw $e;
182
+ }
183
+ }
184
+
185
+ /**
186
+ * Operation createEmailCampaignAsync
187
+ *
188
+ * Create an email campaign
189
+ *
190
+ * @param \SendinBlue\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required)
191
+ *
192
+ * @throws \InvalidArgumentException
193
+ * @return \GuzzleHttp\Promise\PromiseInterface
194
+ */
195
+ public function createEmailCampaignAsync($emailCampaigns)
196
+ {
197
+ return $this->createEmailCampaignAsyncWithHttpInfo($emailCampaigns)
198
+ ->then(
199
+ function ($response) {
200
+ return $response[0];
201
+ }
202
+ );
203
+ }
204
+
205
+ /**
206
+ * Operation createEmailCampaignAsyncWithHttpInfo
207
+ *
208
+ * Create an email campaign
209
+ *
210
+ * @param \SendinBlue\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required)
211
+ *
212
+ * @throws \InvalidArgumentException
213
+ * @return \GuzzleHttp\Promise\PromiseInterface
214
+ */
215
+ public function createEmailCampaignAsyncWithHttpInfo($emailCampaigns)
216
+ {
217
+ $returnType = '\SendinBlue\Client\Model\CreateModel';
218
+ $request = $this->createEmailCampaignRequest($emailCampaigns);
219
+
220
+ return $this->client
221
+ ->sendAsync($request, $this->createHttpClientOption())
222
+ ->then(
223
+ function ($response) use ($returnType) {
224
+ $responseBody = $response->getBody();
225
+ if ($returnType === '\SplFileObject') {
226
+ $content = $responseBody; //stream goes to serializer
227
+ } else {
228
+ $content = $responseBody->getContents();
229
+ if ($returnType !== 'string') {
230
+ $content = json_decode($content);
231
+ }
232
+ }
233
+
234
+ return [
235
+ ObjectSerializer::deserialize($content, $returnType, []),
236
+ $response->getStatusCode(),
237
+ $response->getHeaders()
238
+ ];
239
+ },
240
+ function ($exception) {
241
+ $response = $exception->getResponse();
242
+ $statusCode = $response->getStatusCode();
243
+ throw new ApiException(
244
+ sprintf(
245
+ '[%d] Error connecting to the API (%s)',
246
+ $statusCode,
247
+ $exception->getRequest()->getUri()
248
+ ),
249
+ $statusCode,
250
+ $response->getHeaders(),
251
+ $response->getBody()
252
+ );
253
+ }
254
+ );
255
+ }
256
+
257
+ /**
258
+ * Create request for operation 'createEmailCampaign'
259
+ *
260
+ * @param \SendinBlue\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required)
261
+ *
262
+ * @throws \InvalidArgumentException
263
+ * @return \GuzzleHttp\Psr7\Request
264
+ */
265
+ protected function createEmailCampaignRequest($emailCampaigns)
266
+ {
267
+ // verify the required parameter 'emailCampaigns' is set
268
+ if ($emailCampaigns === null) {
269
+ throw new \InvalidArgumentException(
270
+ 'Missing the required parameter $emailCampaigns when calling createEmailCampaign'
271
+ );
272
+ }
273
+
274
+ $resourcePath = '/emailCampaigns';
275
+ $formParams = [];
276
+ $queryParams = [];
277
+ $headerParams = [];
278
+ $httpBody = '';
279
+ $multipart = false;
280
+
281
+
282
+
283
+ // body params
284
+ $_tempBody = null;
285
+ if (isset($emailCampaigns)) {
286
+ $_tempBody = $emailCampaigns;
287
+ }
288
+
289
+ if ($multipart) {
290
+ $headers = $this->headerSelector->selectHeadersForMultipart(
291
+ ['application/json']
292
+ );
293
+ } else {
294
+ $headers = $this->headerSelector->selectHeaders(
295
+ ['application/json'],
296
+ ['application/json']
297
+ );
298
+ }
299
+
300
+ // for model (json/xml)
301
+ if (isset($_tempBody)) {
302
+ // $_tempBody is the method argument, if present
303
+ $httpBody = $_tempBody;
304
+ // \stdClass has no __toString(), so we should encode it manually
305
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
306
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
307
+ }
308
+ } elseif (count($formParams) > 0) {
309
+ if ($multipart) {
310
+ $multipartContents = [];
311
+ foreach ($formParams as $formParamName => $formParamValue) {
312
+ $multipartContents[] = [
313
+ 'name' => $formParamName,
314
+ 'contents' => $formParamValue
315
+ ];
316
+ }
317
+ // for HTTP post (form)
318
+ $httpBody = new MultipartStream($multipartContents);
319
+
320
+ } elseif ($headers['Content-Type'] === 'application/json') {
321
+ $httpBody = \GuzzleHttp\json_encode($formParams);
322
+
323
+ } else {
324
+ // for HTTP post (form)
325
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
326
+ }
327
+ }
328
+
329
+ // this endpoint requires API key authentication
330
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
331
+ if ($apiKey !== null) {
332
+ $headers['api-key'] = $apiKey;
333
+ }
334
+ // this endpoint requires API key authentication
335
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
336
+ if ($apiKey !== null) {
337
+ $headers['partner-key'] = $apiKey;
338
+ }
339
+
340
+ $defaultHeaders = [];
341
+ if ($this->config->getUserAgent()) {
342
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
343
+ }
344
+
345
+ $headers = array_merge(
346
+ $defaultHeaders,
347
+ $headerParams,
348
+ $headers
349
+ );
350
+
351
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
352
+ return new Request(
353
+ 'POST',
354
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
355
+ $headers,
356
+ $httpBody
357
+ );
358
+ }
359
+
360
+ /**
361
+ * Operation deleteEmailCampaign
362
+ *
363
+ * Delete an email campaign
364
+ *
365
+ * @param int $campaignId id of the campaign (required)
366
+ *
367
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
368
+ * @throws \InvalidArgumentException
369
+ * @return void
370
+ */
371
+ public function deleteEmailCampaign($campaignId)
372
+ {
373
+ $this->deleteEmailCampaignWithHttpInfo($campaignId);
374
+ }
375
+
376
+ /**
377
+ * Operation deleteEmailCampaignWithHttpInfo
378
+ *
379
+ * Delete an email campaign
380
+ *
381
+ * @param int $campaignId id of the campaign (required)
382
+ *
383
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
384
+ * @throws \InvalidArgumentException
385
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
386
+ */
387
+ public function deleteEmailCampaignWithHttpInfo($campaignId)
388
+ {
389
+ $returnType = '';
390
+ $request = $this->deleteEmailCampaignRequest($campaignId);
391
+
392
+ try {
393
+ $options = $this->createHttpClientOption();
394
+ try {
395
+ $response = $this->client->send($request, $options);
396
+ } catch (RequestException $e) {
397
+ throw new ApiException(
398
+ "[{$e->getCode()}] {$e->getMessage()}",
399
+ $e->getCode(),
400
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
401
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
402
+ );
403
+ }
404
+
405
+ $statusCode = $response->getStatusCode();
406
+
407
+ if ($statusCode < 200 || $statusCode > 299) {
408
+ throw new ApiException(
409
+ sprintf(
410
+ '[%d] Error connecting to the API (%s)',
411
+ $statusCode,
412
+ $request->getUri()
413
+ ),
414
+ $statusCode,
415
+ $response->getHeaders(),
416
+ $response->getBody()
417
+ );
418
+ }
419
+
420
+ return [null, $statusCode, $response->getHeaders()];
421
+
422
+ } catch (ApiException $e) {
423
+ switch ($e->getCode()) {
424
+ case 400:
425
+ $data = ObjectSerializer::deserialize(
426
+ $e->getResponseBody(),
427
+ '\SendinBlue\Client\Model\ErrorModel',
428
+ $e->getResponseHeaders()
429
+ );
430
+ $e->setResponseObject($data);
431
+ break;
432
+ case 404:
433
+ $data = ObjectSerializer::deserialize(
434
+ $e->getResponseBody(),
435
+ '\SendinBlue\Client\Model\ErrorModel',
436
+ $e->getResponseHeaders()
437
+ );
438
+ $e->setResponseObject($data);
439
+ break;
440
+ }
441
+ throw $e;
442
+ }
443
+ }
444
+
445
+ /**
446
+ * Operation deleteEmailCampaignAsync
447
+ *
448
+ * Delete an email campaign
449
+ *
450
+ * @param int $campaignId id of the campaign (required)
451
+ *
452
+ * @throws \InvalidArgumentException
453
+ * @return \GuzzleHttp\Promise\PromiseInterface
454
+ */
455
+ public function deleteEmailCampaignAsync($campaignId)
456
+ {
457
+ return $this->deleteEmailCampaignAsyncWithHttpInfo($campaignId)
458
+ ->then(
459
+ function ($response) {
460
+ return $response[0];
461
+ }
462
+ );
463
+ }
464
+
465
+ /**
466
+ * Operation deleteEmailCampaignAsyncWithHttpInfo
467
+ *
468
+ * Delete an email campaign
469
+ *
470
+ * @param int $campaignId id of the campaign (required)
471
+ *
472
+ * @throws \InvalidArgumentException
473
+ * @return \GuzzleHttp\Promise\PromiseInterface
474
+ */
475
+ public function deleteEmailCampaignAsyncWithHttpInfo($campaignId)
476
+ {
477
+ $returnType = '';
478
+ $request = $this->deleteEmailCampaignRequest($campaignId);
479
+
480
+ return $this->client
481
+ ->sendAsync($request, $this->createHttpClientOption())
482
+ ->then(
483
+ function ($response) use ($returnType) {
484
+ return [null, $response->getStatusCode(), $response->getHeaders()];
485
+ },
486
+ function ($exception) {
487
+ $response = $exception->getResponse();
488
+ $statusCode = $response->getStatusCode();
489
+ throw new ApiException(
490
+ sprintf(
491
+ '[%d] Error connecting to the API (%s)',
492
+ $statusCode,
493
+ $exception->getRequest()->getUri()
494
+ ),
495
+ $statusCode,
496
+ $response->getHeaders(),
497
+ $response->getBody()
498
+ );
499
+ }
500
+ );
501
+ }
502
+
503
+ /**
504
+ * Create request for operation 'deleteEmailCampaign'
505
+ *
506
+ * @param int $campaignId id of the campaign (required)
507
+ *
508
+ * @throws \InvalidArgumentException
509
+ * @return \GuzzleHttp\Psr7\Request
510
+ */
511
+ protected function deleteEmailCampaignRequest($campaignId)
512
+ {
513
+ // verify the required parameter 'campaignId' is set
514
+ if ($campaignId === null) {
515
+ throw new \InvalidArgumentException(
516
+ 'Missing the required parameter $campaignId when calling deleteEmailCampaign'
517
+ );
518
+ }
519
+
520
+ $resourcePath = '/emailCampaigns/{campaignId}';
521
+ $formParams = [];
522
+ $queryParams = [];
523
+ $headerParams = [];
524
+ $httpBody = '';
525
+ $multipart = false;
526
+
527
+
528
+ // path params
529
+ if ($campaignId !== null) {
530
+ $resourcePath = str_replace(
531
+ '{' . 'campaignId' . '}',
532
+ ObjectSerializer::toPathValue($campaignId),
533
+ $resourcePath
534
+ );
535
+ }
536
+
537
+ // body params
538
+ $_tempBody = null;
539
+
540
+ if ($multipart) {
541
+ $headers = $this->headerSelector->selectHeadersForMultipart(
542
+ ['application/json']
543
+ );
544
+ } else {
545
+ $headers = $this->headerSelector->selectHeaders(
546
+ ['application/json'],
547
+ ['application/json']
548
+ );
549
+ }
550
+
551
+ // for model (json/xml)
552
+ if (isset($_tempBody)) {
553
+ // $_tempBody is the method argument, if present
554
+ $httpBody = $_tempBody;
555
+ // \stdClass has no __toString(), so we should encode it manually
556
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
557
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
558
+ }
559
+ } elseif (count($formParams) > 0) {
560
+ if ($multipart) {
561
+ $multipartContents = [];
562
+ foreach ($formParams as $formParamName => $formParamValue) {
563
+ $multipartContents[] = [
564
+ 'name' => $formParamName,
565
+ 'contents' => $formParamValue
566
+ ];
567
+ }
568
+ // for HTTP post (form)
569
+ $httpBody = new MultipartStream($multipartContents);
570
+
571
+ } elseif ($headers['Content-Type'] === 'application/json') {
572
+ $httpBody = \GuzzleHttp\json_encode($formParams);
573
+
574
+ } else {
575
+ // for HTTP post (form)
576
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
577
+ }
578
+ }
579
+
580
+ // this endpoint requires API key authentication
581
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
582
+ if ($apiKey !== null) {
583
+ $headers['api-key'] = $apiKey;
584
+ }
585
+ // this endpoint requires API key authentication
586
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
587
+ if ($apiKey !== null) {
588
+ $headers['partner-key'] = $apiKey;
589
+ }
590
+
591
+ $defaultHeaders = [];
592
+ if ($this->config->getUserAgent()) {
593
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
594
+ }
595
+
596
+ $headers = array_merge(
597
+ $defaultHeaders,
598
+ $headerParams,
599
+ $headers
600
+ );
601
+
602
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
603
+ return new Request(
604
+ 'DELETE',
605
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
606
+ $headers,
607
+ $httpBody
608
+ );
609
+ }
610
+
611
+ /**
612
+ * Operation emailExportRecipients
613
+ *
614
+ * Export the recipients of a campaign
615
+ *
616
+ * @param int $campaignId Id of the campaign (required)
617
+ * @param \SendinBlue\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional)
618
+ *
619
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
620
+ * @throws \InvalidArgumentException
621
+ * @return \SendinBlue\Client\Model\CreatedProcessId
622
+ */
623
+ public function emailExportRecipients($campaignId, $recipientExport = null)
624
+ {
625
+ list($response) = $this->emailExportRecipientsWithHttpInfo($campaignId, $recipientExport);
626
+ return $response;
627
+ }
628
+
629
+ /**
630
+ * Operation emailExportRecipientsWithHttpInfo
631
+ *
632
+ * Export the recipients of a campaign
633
+ *
634
+ * @param int $campaignId Id of the campaign (required)
635
+ * @param \SendinBlue\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional)
636
+ *
637
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
638
+ * @throws \InvalidArgumentException
639
+ * @return array of \SendinBlue\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings)
640
+ */
641
+ public function emailExportRecipientsWithHttpInfo($campaignId, $recipientExport = null)
642
+ {
643
+ $returnType = '\SendinBlue\Client\Model\CreatedProcessId';
644
+ $request = $this->emailExportRecipientsRequest($campaignId, $recipientExport);
645
+
646
+ try {
647
+ $options = $this->createHttpClientOption();
648
+ try {
649
+ $response = $this->client->send($request, $options);
650
+ } catch (RequestException $e) {
651
+ throw new ApiException(
652
+ "[{$e->getCode()}] {$e->getMessage()}",
653
+ $e->getCode(),
654
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
655
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
656
+ );
657
+ }
658
+
659
+ $statusCode = $response->getStatusCode();
660
+
661
+ if ($statusCode < 200 || $statusCode > 299) {
662
+ throw new ApiException(
663
+ sprintf(
664
+ '[%d] Error connecting to the API (%s)',
665
+ $statusCode,
666
+ $request->getUri()
667
+ ),
668
+ $statusCode,
669
+ $response->getHeaders(),
670
+ $response->getBody()
671
+ );
672
+ }
673
+
674
+ $responseBody = $response->getBody();
675
+ if ($returnType === '\SplFileObject') {
676
+ $content = $responseBody; //stream goes to serializer
677
+ } else {
678
+ $content = $responseBody->getContents();
679
+ if ($returnType !== 'string') {
680
+ $content = json_decode($content);
681
+ }
682
+ }
683
+
684
+ return [
685
+ ObjectSerializer::deserialize($content, $returnType, []),
686
+ $response->getStatusCode(),
687
+ $response->getHeaders()
688
+ ];
689
+
690
+ } catch (ApiException $e) {
691
+ switch ($e->getCode()) {
692
+ case 202:
693
+ $data = ObjectSerializer::deserialize(
694
+ $e->getResponseBody(),
695
+ '\SendinBlue\Client\Model\CreatedProcessId',
696
+ $e->getResponseHeaders()
697
+ );
698
+ $e->setResponseObject($data);
699
+ break;
700
+ case 400:
701
+ $data = ObjectSerializer::deserialize(
702
+ $e->getResponseBody(),
703
+ '\SendinBlue\Client\Model\ErrorModel',
704
+ $e->getResponseHeaders()
705
+ );
706
+ $e->setResponseObject($data);
707
+ break;
708
+ case 404:
709
+ $data = ObjectSerializer::deserialize(
710
+ $e->getResponseBody(),
711
+ '\SendinBlue\Client\Model\ErrorModel',
712
+ $e->getResponseHeaders()
713
+ );
714
+ $e->setResponseObject($data);
715
+ break;
716
+ }
717
+ throw $e;
718
+ }
719
+ }
720
+
721
+ /**
722
+ * Operation emailExportRecipientsAsync
723
+ *
724
+ * Export the recipients of a campaign
725
+ *
726
+ * @param int $campaignId Id of the campaign (required)
727
+ * @param \SendinBlue\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional)
728
+ *
729
+ * @throws \InvalidArgumentException
730
+ * @return \GuzzleHttp\Promise\PromiseInterface
731
+ */
732
+ public function emailExportRecipientsAsync($campaignId, $recipientExport = null)
733
+ {
734
+ return $this->emailExportRecipientsAsyncWithHttpInfo($campaignId, $recipientExport)
735
+ ->then(
736
+ function ($response) {
737
+ return $response[0];
738
+ }
739
+ );
740
+ }
741
+
742
+ /**
743
+ * Operation emailExportRecipientsAsyncWithHttpInfo
744
+ *
745
+ * Export the recipients of a campaign
746
+ *
747
+ * @param int $campaignId Id of the campaign (required)
748
+ * @param \SendinBlue\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional)
749
+ *
750
+ * @throws \InvalidArgumentException
751
+ * @return \GuzzleHttp\Promise\PromiseInterface
752
+ */
753
+ public function emailExportRecipientsAsyncWithHttpInfo($campaignId, $recipientExport = null)
754
+ {
755
+ $returnType = '\SendinBlue\Client\Model\CreatedProcessId';
756
+ $request = $this->emailExportRecipientsRequest($campaignId, $recipientExport);
757
+
758
+ return $this->client
759
+ ->sendAsync($request, $this->createHttpClientOption())
760
+ ->then(
761
+ function ($response) use ($returnType) {
762
+ $responseBody = $response->getBody();
763
+ if ($returnType === '\SplFileObject') {
764
+ $content = $responseBody; //stream goes to serializer
765
+ } else {
766
+ $content = $responseBody->getContents();
767
+ if ($returnType !== 'string') {
768
+ $content = json_decode($content);
769
+ }
770
+ }
771
+
772
+ return [
773
+ ObjectSerializer::deserialize($content, $returnType, []),
774
+ $response->getStatusCode(),
775
+ $response->getHeaders()
776
+ ];
777
+ },
778
+ function ($exception) {
779
+ $response = $exception->getResponse();
780
+ $statusCode = $response->getStatusCode();
781
+ throw new ApiException(
782
+ sprintf(
783
+ '[%d] Error connecting to the API (%s)',
784
+ $statusCode,
785
+ $exception->getRequest()->getUri()
786
+ ),
787
+ $statusCode,
788
+ $response->getHeaders(),
789
+ $response->getBody()
790
+ );
791
+ }
792
+ );
793
+ }
794
+
795
+ /**
796
+ * Create request for operation 'emailExportRecipients'
797
+ *
798
+ * @param int $campaignId Id of the campaign (required)
799
+ * @param \SendinBlue\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional)
800
+ *
801
+ * @throws \InvalidArgumentException
802
+ * @return \GuzzleHttp\Psr7\Request
803
+ */
804
+ protected function emailExportRecipientsRequest($campaignId, $recipientExport = null)
805
+ {
806
+ // verify the required parameter 'campaignId' is set
807
+ if ($campaignId === null) {
808
+ throw new \InvalidArgumentException(
809
+ 'Missing the required parameter $campaignId when calling emailExportRecipients'
810
+ );
811
+ }
812
+
813
+ $resourcePath = '/emailCampaigns/{campaignId}/exportRecipients';
814
+ $formParams = [];
815
+ $queryParams = [];
816
+ $headerParams = [];
817
+ $httpBody = '';
818
+ $multipart = false;
819
+
820
+
821
+ // path params
822
+ if ($campaignId !== null) {
823
+ $resourcePath = str_replace(
824
+ '{' . 'campaignId' . '}',
825
+ ObjectSerializer::toPathValue($campaignId),
826
+ $resourcePath
827
+ );
828
+ }
829
+
830
+ // body params
831
+ $_tempBody = null;
832
+ if (isset($recipientExport)) {
833
+ $_tempBody = $recipientExport;
834
+ }
835
+
836
+ if ($multipart) {
837
+ $headers = $this->headerSelector->selectHeadersForMultipart(
838
+ ['application/json']
839
+ );
840
+ } else {
841
+ $headers = $this->headerSelector->selectHeaders(
842
+ ['application/json'],
843
+ ['application/json']
844
+ );
845
+ }
846
+
847
+ // for model (json/xml)
848
+ if (isset($_tempBody)) {
849
+ // $_tempBody is the method argument, if present
850
+ $httpBody = $_tempBody;
851
+ // \stdClass has no __toString(), so we should encode it manually
852
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
853
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
854
+ }
855
+ } elseif (count($formParams) > 0) {
856
+ if ($multipart) {
857
+ $multipartContents = [];
858
+ foreach ($formParams as $formParamName => $formParamValue) {
859
+ $multipartContents[] = [
860
+ 'name' => $formParamName,
861
+ 'contents' => $formParamValue
862
+ ];
863
+ }
864
+ // for HTTP post (form)
865
+ $httpBody = new MultipartStream($multipartContents);
866
+
867
+ } elseif ($headers['Content-Type'] === 'application/json') {
868
+ $httpBody = \GuzzleHttp\json_encode($formParams);
869
+
870
+ } else {
871
+ // for HTTP post (form)
872
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
873
+ }
874
+ }
875
+
876
+ // this endpoint requires API key authentication
877
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
878
+ if ($apiKey !== null) {
879
+ $headers['api-key'] = $apiKey;
880
+ }
881
+ // this endpoint requires API key authentication
882
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
883
+ if ($apiKey !== null) {
884
+ $headers['partner-key'] = $apiKey;
885
+ }
886
+
887
+ $defaultHeaders = [];
888
+ if ($this->config->getUserAgent()) {
889
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
890
+ }
891
+
892
+ $headers = array_merge(
893
+ $defaultHeaders,
894
+ $headerParams,
895
+ $headers
896
+ );
897
+
898
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
899
+ return new Request(
900
+ 'POST',
901
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
902
+ $headers,
903
+ $httpBody
904
+ );
905
+ }
906
+
907
+ /**
908
+ * Operation getEmailCampaign
909
+ *
910
+ * Get campaign informations
911
+ *
912
+ * @param int $campaignId Id of the campaign (required)
913
+ *
914
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
915
+ * @throws \InvalidArgumentException
916
+ * @return \SendinBlue\Client\Model\GetEmailCampaign
917
+ */
918
+ public function getEmailCampaign($campaignId)
919
+ {
920
+ list($response) = $this->getEmailCampaignWithHttpInfo($campaignId);
921
+ return $response;
922
+ }
923
+
924
+ /**
925
+ * Operation getEmailCampaignWithHttpInfo
926
+ *
927
+ * Get campaign informations
928
+ *
929
+ * @param int $campaignId Id of the campaign (required)
930
+ *
931
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
932
+ * @throws \InvalidArgumentException
933
+ * @return array of \SendinBlue\Client\Model\GetEmailCampaign, HTTP status code, HTTP response headers (array of strings)
934
+ */
935
+ public function getEmailCampaignWithHttpInfo($campaignId)
936
+ {
937
+ $returnType = '\SendinBlue\Client\Model\GetEmailCampaign';
938
+ $request = $this->getEmailCampaignRequest($campaignId);
939
+
940
+ try {
941
+ $options = $this->createHttpClientOption();
942
+ try {
943
+ $response = $this->client->send($request, $options);
944
+ } catch (RequestException $e) {
945
+ throw new ApiException(
946
+ "[{$e->getCode()}] {$e->getMessage()}",
947
+ $e->getCode(),
948
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
949
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
950
+ );
951
+ }
952
+
953
+ $statusCode = $response->getStatusCode();
954
+
955
+ if ($statusCode < 200 || $statusCode > 299) {
956
+ throw new ApiException(
957
+ sprintf(
958
+ '[%d] Error connecting to the API (%s)',
959
+ $statusCode,
960
+ $request->getUri()
961
+ ),
962
+ $statusCode,
963
+ $response->getHeaders(),
964
+ $response->getBody()
965
+ );
966
+ }
967
+
968
+ $responseBody = $response->getBody();
969
+ if ($returnType === '\SplFileObject') {
970
+ $content = $responseBody; //stream goes to serializer
971
+ } else {
972
+ $content = $responseBody->getContents();
973
+ if ($returnType !== 'string') {
974
+ $content = json_decode($content);
975
+ }
976
+ }
977
+
978
+ return [
979
+ ObjectSerializer::deserialize($content, $returnType, []),
980
+ $response->getStatusCode(),
981
+ $response->getHeaders()
982
+ ];
983
+
984
+ } catch (ApiException $e) {
985
+ switch ($e->getCode()) {
986
+ case 200:
987
+ $data = ObjectSerializer::deserialize(
988
+ $e->getResponseBody(),
989
+ '\SendinBlue\Client\Model\GetEmailCampaign',
990
+ $e->getResponseHeaders()
991
+ );
992
+ $e->setResponseObject($data);
993
+ break;
994
+ case 400:
995
+ $data = ObjectSerializer::deserialize(
996
+ $e->getResponseBody(),
997
+ '\SendinBlue\Client\Model\ErrorModel',
998
+ $e->getResponseHeaders()
999
+ );
1000
+ $e->setResponseObject($data);
1001
+ break;
1002
+ case 404:
1003
+ $data = ObjectSerializer::deserialize(
1004
+ $e->getResponseBody(),
1005
+ '\SendinBlue\Client\Model\ErrorModel',
1006
+ $e->getResponseHeaders()
1007
+ );
1008
+ $e->setResponseObject($data);
1009
+ break;
1010
+ }
1011
+ throw $e;
1012
+ }
1013
+ }
1014
+
1015
+ /**
1016
+ * Operation getEmailCampaignAsync
1017
+ *
1018
+ * Get campaign informations
1019
+ *
1020
+ * @param int $campaignId Id of the campaign (required)
1021
+ *
1022
+ * @throws \InvalidArgumentException
1023
+ * @return \GuzzleHttp\Promise\PromiseInterface
1024
+ */
1025
+ public function getEmailCampaignAsync($campaignId)
1026
+ {
1027
+ return $this->getEmailCampaignAsyncWithHttpInfo($campaignId)
1028
+ ->then(
1029
+ function ($response) {
1030
+ return $response[0];
1031
+ }
1032
+ );
1033
+ }
1034
+
1035
+ /**
1036
+ * Operation getEmailCampaignAsyncWithHttpInfo
1037
+ *
1038
+ * Get campaign informations
1039
+ *
1040
+ * @param int $campaignId Id of the campaign (required)
1041
+ *
1042
+ * @throws \InvalidArgumentException
1043
+ * @return \GuzzleHttp\Promise\PromiseInterface
1044
+ */
1045
+ public function getEmailCampaignAsyncWithHttpInfo($campaignId)
1046
+ {
1047
+ $returnType = '\SendinBlue\Client\Model\GetEmailCampaign';
1048
+ $request = $this->getEmailCampaignRequest($campaignId);
1049
+
1050
+ return $this->client
1051
+ ->sendAsync($request, $this->createHttpClientOption())
1052
+ ->then(
1053
+ function ($response) use ($returnType) {
1054
+ $responseBody = $response->getBody();
1055
+ if ($returnType === '\SplFileObject') {
1056
+ $content = $responseBody; //stream goes to serializer
1057
+ } else {
1058
+ $content = $responseBody->getContents();
1059
+ if ($returnType !== 'string') {
1060
+ $content = json_decode($content);
1061
+ }
1062
+ }
1063
+
1064
+ return [
1065
+ ObjectSerializer::deserialize($content, $returnType, []),
1066
+ $response->getStatusCode(),
1067
+ $response->getHeaders()
1068
+ ];
1069
+ },
1070
+ function ($exception) {
1071
+ $response = $exception->getResponse();
1072
+ $statusCode = $response->getStatusCode();
1073
+ throw new ApiException(
1074
+ sprintf(
1075
+ '[%d] Error connecting to the API (%s)',
1076
+ $statusCode,
1077
+ $exception->getRequest()->getUri()
1078
+ ),
1079
+ $statusCode,
1080
+ $response->getHeaders(),
1081
+ $response->getBody()
1082
+ );
1083
+ }
1084
+ );
1085
+ }
1086
+
1087
+ /**
1088
+ * Create request for operation 'getEmailCampaign'
1089
+ *
1090
+ * @param int $campaignId Id of the campaign (required)
1091
+ *
1092
+ * @throws \InvalidArgumentException
1093
+ * @return \GuzzleHttp\Psr7\Request
1094
+ */
1095
+ protected function getEmailCampaignRequest($campaignId)
1096
+ {
1097
+ // verify the required parameter 'campaignId' is set
1098
+ if ($campaignId === null) {
1099
+ throw new \InvalidArgumentException(
1100
+ 'Missing the required parameter $campaignId when calling getEmailCampaign'
1101
+ );
1102
+ }
1103
+
1104
+ $resourcePath = '/emailCampaigns/{campaignId}';
1105
+ $formParams = [];
1106
+ $queryParams = [];
1107
+ $headerParams = [];
1108
+ $httpBody = '';
1109
+ $multipart = false;
1110
+
1111
+
1112
+ // path params
1113
+ if ($campaignId !== null) {
1114
+ $resourcePath = str_replace(
1115
+ '{' . 'campaignId' . '}',
1116
+ ObjectSerializer::toPathValue($campaignId),
1117
+ $resourcePath
1118
+ );
1119
+ }
1120
+
1121
+ // body params
1122
+ $_tempBody = null;
1123
+
1124
+ if ($multipart) {
1125
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1126
+ ['application/json']
1127
+ );
1128
+ } else {
1129
+ $headers = $this->headerSelector->selectHeaders(
1130
+ ['application/json'],
1131
+ ['application/json']
1132
+ );
1133
+ }
1134
+
1135
+ // for model (json/xml)
1136
+ if (isset($_tempBody)) {
1137
+ // $_tempBody is the method argument, if present
1138
+ $httpBody = $_tempBody;
1139
+ // \stdClass has no __toString(), so we should encode it manually
1140
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1141
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1142
+ }
1143
+ } elseif (count($formParams) > 0) {
1144
+ if ($multipart) {
1145
+ $multipartContents = [];
1146
+ foreach ($formParams as $formParamName => $formParamValue) {
1147
+ $multipartContents[] = [
1148
+ 'name' => $formParamName,
1149
+ 'contents' => $formParamValue
1150
+ ];
1151
+ }
1152
+ // for HTTP post (form)
1153
+ $httpBody = new MultipartStream($multipartContents);
1154
+
1155
+ } elseif ($headers['Content-Type'] === 'application/json') {
1156
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1157
+
1158
+ } else {
1159
+ // for HTTP post (form)
1160
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1161
+ }
1162
+ }
1163
+
1164
+ // this endpoint requires API key authentication
1165
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1166
+ if ($apiKey !== null) {
1167
+ $headers['api-key'] = $apiKey;
1168
+ }
1169
+ // this endpoint requires API key authentication
1170
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1171
+ if ($apiKey !== null) {
1172
+ $headers['partner-key'] = $apiKey;
1173
+ }
1174
+
1175
+ $defaultHeaders = [];
1176
+ if ($this->config->getUserAgent()) {
1177
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1178
+ }
1179
+
1180
+ $headers = array_merge(
1181
+ $defaultHeaders,
1182
+ $headerParams,
1183
+ $headers
1184
+ );
1185
+
1186
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1187
+ return new Request(
1188
+ 'GET',
1189
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1190
+ $headers,
1191
+ $httpBody
1192
+ );
1193
+ }
1194
+
1195
+ /**
1196
+ * Operation getEmailCampaigns
1197
+ *
1198
+ * Return all your created campaigns
1199
+ *
1200
+ * @param string $type Filter on the type of the campaigns (optional)
1201
+ * @param string $status Filter on the status of the campaign (optional)
1202
+ * @param \DateTime $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1203
+ * @param \DateTime $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1204
+ * @param int $limit Number of documents per page (optional, default to 500)
1205
+ * @param int $offset Index of the first document in the page (optional, default to 0)
1206
+ *
1207
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1208
+ * @throws \InvalidArgumentException
1209
+ * @return \SendinBlue\Client\Model\GetEmailCampaigns
1210
+ */
1211
+ public function getEmailCampaigns($type = null, $status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0')
1212
+ {
1213
+ list($response) = $this->getEmailCampaignsWithHttpInfo($type, $status, $startDate, $endDate, $limit, $offset);
1214
+ return $response;
1215
+ }
1216
+
1217
+ /**
1218
+ * Operation getEmailCampaignsWithHttpInfo
1219
+ *
1220
+ * Return all your created campaigns
1221
+ *
1222
+ * @param string $type Filter on the type of the campaigns (optional)
1223
+ * @param string $status Filter on the status of the campaign (optional)
1224
+ * @param \DateTime $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1225
+ * @param \DateTime $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1226
+ * @param int $limit Number of documents per page (optional, default to 500)
1227
+ * @param int $offset Index of the first document in the page (optional, default to 0)
1228
+ *
1229
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1230
+ * @throws \InvalidArgumentException
1231
+ * @return array of \SendinBlue\Client\Model\GetEmailCampaigns, HTTP status code, HTTP response headers (array of strings)
1232
+ */
1233
+ public function getEmailCampaignsWithHttpInfo($type = null, $status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0')
1234
+ {
1235
+ $returnType = '\SendinBlue\Client\Model\GetEmailCampaigns';
1236
+ $request = $this->getEmailCampaignsRequest($type, $status, $startDate, $endDate, $limit, $offset);
1237
+
1238
+ try {
1239
+ $options = $this->createHttpClientOption();
1240
+ try {
1241
+ $response = $this->client->send($request, $options);
1242
+ } catch (RequestException $e) {
1243
+ throw new ApiException(
1244
+ "[{$e->getCode()}] {$e->getMessage()}",
1245
+ $e->getCode(),
1246
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1247
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1248
+ );
1249
+ }
1250
+
1251
+ $statusCode = $response->getStatusCode();
1252
+
1253
+ if ($statusCode < 200 || $statusCode > 299) {
1254
+ throw new ApiException(
1255
+ sprintf(
1256
+ '[%d] Error connecting to the API (%s)',
1257
+ $statusCode,
1258
+ $request->getUri()
1259
+ ),
1260
+ $statusCode,
1261
+ $response->getHeaders(),
1262
+ $response->getBody()
1263
+ );
1264
+ }
1265
+
1266
+ $responseBody = $response->getBody();
1267
+ if ($returnType === '\SplFileObject') {
1268
+ $content = $responseBody; //stream goes to serializer
1269
+ } else {
1270
+ $content = $responseBody->getContents();
1271
+ if ($returnType !== 'string') {
1272
+ $content = json_decode($content);
1273
+ }
1274
+ }
1275
+
1276
+ return [
1277
+ ObjectSerializer::deserialize($content, $returnType, []),
1278
+ $response->getStatusCode(),
1279
+ $response->getHeaders()
1280
+ ];
1281
+
1282
+ } catch (ApiException $e) {
1283
+ switch ($e->getCode()) {
1284
+ case 200:
1285
+ $data = ObjectSerializer::deserialize(
1286
+ $e->getResponseBody(),
1287
+ '\SendinBlue\Client\Model\GetEmailCampaigns',
1288
+ $e->getResponseHeaders()
1289
+ );
1290
+ $e->setResponseObject($data);
1291
+ break;
1292
+ case 400:
1293
+ $data = ObjectSerializer::deserialize(
1294
+ $e->getResponseBody(),
1295
+ '\SendinBlue\Client\Model\ErrorModel',
1296
+ $e->getResponseHeaders()
1297
+ );
1298
+ $e->setResponseObject($data);
1299
+ break;
1300
+ }
1301
+ throw $e;
1302
+ }
1303
+ }
1304
+
1305
+ /**
1306
+ * Operation getEmailCampaignsAsync
1307
+ *
1308
+ * Return all your created campaigns
1309
+ *
1310
+ * @param string $type Filter on the type of the campaigns (optional)
1311
+ * @param string $status Filter on the status of the campaign (optional)
1312
+ * @param \DateTime $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1313
+ * @param \DateTime $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1314
+ * @param int $limit Number of documents per page (optional, default to 500)
1315
+ * @param int $offset Index of the first document in the page (optional, default to 0)
1316
+ *
1317
+ * @throws \InvalidArgumentException
1318
+ * @return \GuzzleHttp\Promise\PromiseInterface
1319
+ */
1320
+ public function getEmailCampaignsAsync($type = null, $status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0')
1321
+ {
1322
+ return $this->getEmailCampaignsAsyncWithHttpInfo($type, $status, $startDate, $endDate, $limit, $offset)
1323
+ ->then(
1324
+ function ($response) {
1325
+ return $response[0];
1326
+ }
1327
+ );
1328
+ }
1329
+
1330
+ /**
1331
+ * Operation getEmailCampaignsAsyncWithHttpInfo
1332
+ *
1333
+ * Return all your created campaigns
1334
+ *
1335
+ * @param string $type Filter on the type of the campaigns (optional)
1336
+ * @param string $status Filter on the status of the campaign (optional)
1337
+ * @param \DateTime $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1338
+ * @param \DateTime $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1339
+ * @param int $limit Number of documents per page (optional, default to 500)
1340
+ * @param int $offset Index of the first document in the page (optional, default to 0)
1341
+ *
1342
+ * @throws \InvalidArgumentException
1343
+ * @return \GuzzleHttp\Promise\PromiseInterface
1344
+ */
1345
+ public function getEmailCampaignsAsyncWithHttpInfo($type = null, $status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0')
1346
+ {
1347
+ $returnType = '\SendinBlue\Client\Model\GetEmailCampaigns';
1348
+ $request = $this->getEmailCampaignsRequest($type, $status, $startDate, $endDate, $limit, $offset);
1349
+
1350
+ return $this->client
1351
+ ->sendAsync($request, $this->createHttpClientOption())
1352
+ ->then(
1353
+ function ($response) use ($returnType) {
1354
+ $responseBody = $response->getBody();
1355
+ if ($returnType === '\SplFileObject') {
1356
+ $content = $responseBody; //stream goes to serializer
1357
+ } else {
1358
+ $content = $responseBody->getContents();
1359
+ if ($returnType !== 'string') {
1360
+ $content = json_decode($content);
1361
+ }
1362
+ }
1363
+
1364
+ return [
1365
+ ObjectSerializer::deserialize($content, $returnType, []),
1366
+ $response->getStatusCode(),
1367
+ $response->getHeaders()
1368
+ ];
1369
+ },
1370
+ function ($exception) {
1371
+ $response = $exception->getResponse();
1372
+ $statusCode = $response->getStatusCode();
1373
+ throw new ApiException(
1374
+ sprintf(
1375
+ '[%d] Error connecting to the API (%s)',
1376
+ $statusCode,
1377
+ $exception->getRequest()->getUri()
1378
+ ),
1379
+ $statusCode,
1380
+ $response->getHeaders(),
1381
+ $response->getBody()
1382
+ );
1383
+ }
1384
+ );
1385
+ }
1386
+
1387
+ /**
1388
+ * Create request for operation 'getEmailCampaigns'
1389
+ *
1390
+ * @param string $type Filter on the type of the campaigns (optional)
1391
+ * @param string $status Filter on the status of the campaign (optional)
1392
+ * @param \DateTime $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1393
+ * @param \DateTime $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1394
+ * @param int $limit Number of documents per page (optional, default to 500)
1395
+ * @param int $offset Index of the first document in the page (optional, default to 0)
1396
+ *
1397
+ * @throws \InvalidArgumentException
1398
+ * @return \GuzzleHttp\Psr7\Request
1399
+ */
1400
+ protected function getEmailCampaignsRequest($type = null, $status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0')
1401
+ {
1402
+ if ($limit !== null && $limit > 1000) {
1403
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling EmailCampaignsApi.getEmailCampaigns, must be smaller than or equal to 1000.');
1404
+ }
1405
+
1406
+
1407
+ $resourcePath = '/emailCampaigns';
1408
+ $formParams = [];
1409
+ $queryParams = [];
1410
+ $headerParams = [];
1411
+ $httpBody = '';
1412
+ $multipart = false;
1413
+
1414
+ // query params
1415
+ if ($type !== null) {
1416
+ $queryParams['type'] = ObjectSerializer::toQueryValue($type);
1417
+ }
1418
+ // query params
1419
+ if ($status !== null) {
1420
+ $queryParams['status'] = ObjectSerializer::toQueryValue($status);
1421
+ }
1422
+ // query params
1423
+ if ($startDate !== null) {
1424
+ $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate);
1425
+ }
1426
+ // query params
1427
+ if ($endDate !== null) {
1428
+ $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate);
1429
+ }
1430
+ // query params
1431
+ if ($limit !== null) {
1432
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
1433
+ }
1434
+ // query params
1435
+ if ($offset !== null) {
1436
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
1437
+ }
1438
+
1439
+
1440
+ // body params
1441
+ $_tempBody = null;
1442
+
1443
+ if ($multipart) {
1444
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1445
+ ['application/json']
1446
+ );
1447
+ } else {
1448
+ $headers = $this->headerSelector->selectHeaders(
1449
+ ['application/json'],
1450
+ ['application/json']
1451
+ );
1452
+ }
1453
+
1454
+ // for model (json/xml)
1455
+ if (isset($_tempBody)) {
1456
+ // $_tempBody is the method argument, if present
1457
+ $httpBody = $_tempBody;
1458
+ // \stdClass has no __toString(), so we should encode it manually
1459
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1460
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1461
+ }
1462
+ } elseif (count($formParams) > 0) {
1463
+ if ($multipart) {
1464
+ $multipartContents = [];
1465
+ foreach ($formParams as $formParamName => $formParamValue) {
1466
+ $multipartContents[] = [
1467
+ 'name' => $formParamName,
1468
+ 'contents' => $formParamValue
1469
+ ];
1470
+ }
1471
+ // for HTTP post (form)
1472
+ $httpBody = new MultipartStream($multipartContents);
1473
+
1474
+ } elseif ($headers['Content-Type'] === 'application/json') {
1475
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1476
+
1477
+ } else {
1478
+ // for HTTP post (form)
1479
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1480
+ }
1481
+ }
1482
+
1483
+ // this endpoint requires API key authentication
1484
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1485
+ if ($apiKey !== null) {
1486
+ $headers['api-key'] = $apiKey;
1487
+ }
1488
+ // this endpoint requires API key authentication
1489
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1490
+ if ($apiKey !== null) {
1491
+ $headers['partner-key'] = $apiKey;
1492
+ }
1493
+
1494
+ $defaultHeaders = [];
1495
+ if ($this->config->getUserAgent()) {
1496
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1497
+ }
1498
+
1499
+ $headers = array_merge(
1500
+ $defaultHeaders,
1501
+ $headerParams,
1502
+ $headers
1503
+ );
1504
+
1505
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1506
+ return new Request(
1507
+ 'GET',
1508
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1509
+ $headers,
1510
+ $httpBody
1511
+ );
1512
+ }
1513
+
1514
+ /**
1515
+ * Operation sendEmailCampaignNow
1516
+ *
1517
+ * Send an email campaign id of the campaign immediately
1518
+ *
1519
+ * @param int $campaignId Id of the campaign (required)
1520
+ *
1521
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1522
+ * @throws \InvalidArgumentException
1523
+ * @return void
1524
+ */
1525
+ public function sendEmailCampaignNow($campaignId)
1526
+ {
1527
+ $this->sendEmailCampaignNowWithHttpInfo($campaignId);
1528
+ }
1529
+
1530
+ /**
1531
+ * Operation sendEmailCampaignNowWithHttpInfo
1532
+ *
1533
+ * Send an email campaign id of the campaign immediately
1534
+ *
1535
+ * @param int $campaignId Id of the campaign (required)
1536
+ *
1537
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1538
+ * @throws \InvalidArgumentException
1539
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
1540
+ */
1541
+ public function sendEmailCampaignNowWithHttpInfo($campaignId)
1542
+ {
1543
+ $returnType = '';
1544
+ $request = $this->sendEmailCampaignNowRequest($campaignId);
1545
+
1546
+ try {
1547
+ $options = $this->createHttpClientOption();
1548
+ try {
1549
+ $response = $this->client->send($request, $options);
1550
+ } catch (RequestException $e) {
1551
+ throw new ApiException(
1552
+ "[{$e->getCode()}] {$e->getMessage()}",
1553
+ $e->getCode(),
1554
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1555
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1556
+ );
1557
+ }
1558
+
1559
+ $statusCode = $response->getStatusCode();
1560
+
1561
+ if ($statusCode < 200 || $statusCode > 299) {
1562
+ throw new ApiException(
1563
+ sprintf(
1564
+ '[%d] Error connecting to the API (%s)',
1565
+ $statusCode,
1566
+ $request->getUri()
1567
+ ),
1568
+ $statusCode,
1569
+ $response->getHeaders(),
1570
+ $response->getBody()
1571
+ );
1572
+ }
1573
+
1574
+ return [null, $statusCode, $response->getHeaders()];
1575
+
1576
+ } catch (ApiException $e) {
1577
+ switch ($e->getCode()) {
1578
+ case 400:
1579
+ $data = ObjectSerializer::deserialize(
1580
+ $e->getResponseBody(),
1581
+ '\SendinBlue\Client\Model\ErrorModel',
1582
+ $e->getResponseHeaders()
1583
+ );
1584
+ $e->setResponseObject($data);
1585
+ break;
1586
+ case 402:
1587
+ $data = ObjectSerializer::deserialize(
1588
+ $e->getResponseBody(),
1589
+ '\SendinBlue\Client\Model\ErrorModel',
1590
+ $e->getResponseHeaders()
1591
+ );
1592
+ $e->setResponseObject($data);
1593
+ break;
1594
+ case 404:
1595
+ $data = ObjectSerializer::deserialize(
1596
+ $e->getResponseBody(),
1597
+ '\SendinBlue\Client\Model\ErrorModel',
1598
+ $e->getResponseHeaders()
1599
+ );
1600
+ $e->setResponseObject($data);
1601
+ break;
1602
+ }
1603
+ throw $e;
1604
+ }
1605
+ }
1606
+
1607
+ /**
1608
+ * Operation sendEmailCampaignNowAsync
1609
+ *
1610
+ * Send an email campaign id of the campaign immediately
1611
+ *
1612
+ * @param int $campaignId Id of the campaign (required)
1613
+ *
1614
+ * @throws \InvalidArgumentException
1615
+ * @return \GuzzleHttp\Promise\PromiseInterface
1616
+ */
1617
+ public function sendEmailCampaignNowAsync($campaignId)
1618
+ {
1619
+ return $this->sendEmailCampaignNowAsyncWithHttpInfo($campaignId)
1620
+ ->then(
1621
+ function ($response) {
1622
+ return $response[0];
1623
+ }
1624
+ );
1625
+ }
1626
+
1627
+ /**
1628
+ * Operation sendEmailCampaignNowAsyncWithHttpInfo
1629
+ *
1630
+ * Send an email campaign id of the campaign immediately
1631
+ *
1632
+ * @param int $campaignId Id of the campaign (required)
1633
+ *
1634
+ * @throws \InvalidArgumentException
1635
+ * @return \GuzzleHttp\Promise\PromiseInterface
1636
+ */
1637
+ public function sendEmailCampaignNowAsyncWithHttpInfo($campaignId)
1638
+ {
1639
+ $returnType = '';
1640
+ $request = $this->sendEmailCampaignNowRequest($campaignId);
1641
+
1642
+ return $this->client
1643
+ ->sendAsync($request, $this->createHttpClientOption())
1644
+ ->then(
1645
+ function ($response) use ($returnType) {
1646
+ return [null, $response->getStatusCode(), $response->getHeaders()];
1647
+ },
1648
+ function ($exception) {
1649
+ $response = $exception->getResponse();
1650
+ $statusCode = $response->getStatusCode();
1651
+ throw new ApiException(
1652
+ sprintf(
1653
+ '[%d] Error connecting to the API (%s)',
1654
+ $statusCode,
1655
+ $exception->getRequest()->getUri()
1656
+ ),
1657
+ $statusCode,
1658
+ $response->getHeaders(),
1659
+ $response->getBody()
1660
+ );
1661
+ }
1662
+ );
1663
+ }
1664
+
1665
+ /**
1666
+ * Create request for operation 'sendEmailCampaignNow'
1667
+ *
1668
+ * @param int $campaignId Id of the campaign (required)
1669
+ *
1670
+ * @throws \InvalidArgumentException
1671
+ * @return \GuzzleHttp\Psr7\Request
1672
+ */
1673
+ protected function sendEmailCampaignNowRequest($campaignId)
1674
+ {
1675
+ // verify the required parameter 'campaignId' is set
1676
+ if ($campaignId === null) {
1677
+ throw new \InvalidArgumentException(
1678
+ 'Missing the required parameter $campaignId when calling sendEmailCampaignNow'
1679
+ );
1680
+ }
1681
+
1682
+ $resourcePath = '/emailCampaigns/{campaignId}/sendNow';
1683
+ $formParams = [];
1684
+ $queryParams = [];
1685
+ $headerParams = [];
1686
+ $httpBody = '';
1687
+ $multipart = false;
1688
+
1689
+
1690
+ // path params
1691
+ if ($campaignId !== null) {
1692
+ $resourcePath = str_replace(
1693
+ '{' . 'campaignId' . '}',
1694
+ ObjectSerializer::toPathValue($campaignId),
1695
+ $resourcePath
1696
+ );
1697
+ }
1698
+
1699
+ // body params
1700
+ $_tempBody = null;
1701
+
1702
+ if ($multipart) {
1703
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1704
+ ['application/json']
1705
+ );
1706
+ } else {
1707
+ $headers = $this->headerSelector->selectHeaders(
1708
+ ['application/json'],
1709
+ ['application/json']
1710
+ );
1711
+ }
1712
+
1713
+ // for model (json/xml)
1714
+ if (isset($_tempBody)) {
1715
+ // $_tempBody is the method argument, if present
1716
+ $httpBody = $_tempBody;
1717
+ // \stdClass has no __toString(), so we should encode it manually
1718
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1719
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1720
+ }
1721
+ } elseif (count($formParams) > 0) {
1722
+ if ($multipart) {
1723
+ $multipartContents = [];
1724
+ foreach ($formParams as $formParamName => $formParamValue) {
1725
+ $multipartContents[] = [
1726
+ 'name' => $formParamName,
1727
+ 'contents' => $formParamValue
1728
+ ];
1729
+ }
1730
+ // for HTTP post (form)
1731
+ $httpBody = new MultipartStream($multipartContents);
1732
+
1733
+ } elseif ($headers['Content-Type'] === 'application/json') {
1734
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1735
+
1736
+ } else {
1737
+ // for HTTP post (form)
1738
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1739
+ }
1740
+ }
1741
+
1742
+ // this endpoint requires API key authentication
1743
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1744
+ if ($apiKey !== null) {
1745
+ $headers['api-key'] = $apiKey;
1746
+ }
1747
+ // this endpoint requires API key authentication
1748
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1749
+ if ($apiKey !== null) {
1750
+ $headers['partner-key'] = $apiKey;
1751
+ }
1752
+
1753
+ $defaultHeaders = [];
1754
+ if ($this->config->getUserAgent()) {
1755
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1756
+ }
1757
+
1758
+ $headers = array_merge(
1759
+ $defaultHeaders,
1760
+ $headerParams,
1761
+ $headers
1762
+ );
1763
+
1764
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1765
+ return new Request(
1766
+ 'POST',
1767
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1768
+ $headers,
1769
+ $httpBody
1770
+ );
1771
+ }
1772
+
1773
+ /**
1774
+ * Operation sendReport
1775
+ *
1776
+ * Send the report of a campaigns
1777
+ *
1778
+ * @param int $campaignId Id of the campaign (required)
1779
+ * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required)
1780
+ *
1781
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1782
+ * @throws \InvalidArgumentException
1783
+ * @return void
1784
+ */
1785
+ public function sendReport($campaignId, $sendReport)
1786
+ {
1787
+ $this->sendReportWithHttpInfo($campaignId, $sendReport);
1788
+ }
1789
+
1790
+ /**
1791
+ * Operation sendReportWithHttpInfo
1792
+ *
1793
+ * Send the report of a campaigns
1794
+ *
1795
+ * @param int $campaignId Id of the campaign (required)
1796
+ * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required)
1797
+ *
1798
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1799
+ * @throws \InvalidArgumentException
1800
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
1801
+ */
1802
+ public function sendReportWithHttpInfo($campaignId, $sendReport)
1803
+ {
1804
+ $returnType = '';
1805
+ $request = $this->sendReportRequest($campaignId, $sendReport);
1806
+
1807
+ try {
1808
+ $options = $this->createHttpClientOption();
1809
+ try {
1810
+ $response = $this->client->send($request, $options);
1811
+ } catch (RequestException $e) {
1812
+ throw new ApiException(
1813
+ "[{$e->getCode()}] {$e->getMessage()}",
1814
+ $e->getCode(),
1815
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1816
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1817
+ );
1818
+ }
1819
+
1820
+ $statusCode = $response->getStatusCode();
1821
+
1822
+ if ($statusCode < 200 || $statusCode > 299) {
1823
+ throw new ApiException(
1824
+ sprintf(
1825
+ '[%d] Error connecting to the API (%s)',
1826
+ $statusCode,
1827
+ $request->getUri()
1828
+ ),
1829
+ $statusCode,
1830
+ $response->getHeaders(),
1831
+ $response->getBody()
1832
+ );
1833
+ }
1834
+
1835
+ return [null, $statusCode, $response->getHeaders()];
1836
+
1837
+ } catch (ApiException $e) {
1838
+ switch ($e->getCode()) {
1839
+ case 400:
1840
+ $data = ObjectSerializer::deserialize(
1841
+ $e->getResponseBody(),
1842
+ '\SendinBlue\Client\Model\ErrorModel',
1843
+ $e->getResponseHeaders()
1844
+ );
1845
+ $e->setResponseObject($data);
1846
+ break;
1847
+ case 404:
1848
+ $data = ObjectSerializer::deserialize(
1849
+ $e->getResponseBody(),
1850
+ '\SendinBlue\Client\Model\ErrorModel',
1851
+ $e->getResponseHeaders()
1852
+ );
1853
+ $e->setResponseObject($data);
1854
+ break;
1855
+ }
1856
+ throw $e;
1857
+ }
1858
+ }
1859
+
1860
+ /**
1861
+ * Operation sendReportAsync
1862
+ *
1863
+ * Send the report of a campaigns
1864
+ *
1865
+ * @param int $campaignId Id of the campaign (required)
1866
+ * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required)
1867
+ *
1868
+ * @throws \InvalidArgumentException
1869
+ * @return \GuzzleHttp\Promise\PromiseInterface
1870
+ */
1871
+ public function sendReportAsync($campaignId, $sendReport)
1872
+ {
1873
+ return $this->sendReportAsyncWithHttpInfo($campaignId, $sendReport)
1874
+ ->then(
1875
+ function ($response) {
1876
+ return $response[0];
1877
+ }
1878
+ );
1879
+ }
1880
+
1881
+ /**
1882
+ * Operation sendReportAsyncWithHttpInfo
1883
+ *
1884
+ * Send the report of a campaigns
1885
+ *
1886
+ * @param int $campaignId Id of the campaign (required)
1887
+ * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required)
1888
+ *
1889
+ * @throws \InvalidArgumentException
1890
+ * @return \GuzzleHttp\Promise\PromiseInterface
1891
+ */
1892
+ public function sendReportAsyncWithHttpInfo($campaignId, $sendReport)
1893
+ {
1894
+ $returnType = '';
1895
+ $request = $this->sendReportRequest($campaignId, $sendReport);
1896
+
1897
+ return $this->client
1898
+ ->sendAsync($request, $this->createHttpClientOption())
1899
+ ->then(
1900
+ function ($response) use ($returnType) {
1901
+ return [null, $response->getStatusCode(), $response->getHeaders()];
1902
+ },
1903
+ function ($exception) {
1904
+ $response = $exception->getResponse();
1905
+ $statusCode = $response->getStatusCode();
1906
+ throw new ApiException(
1907
+ sprintf(
1908
+ '[%d] Error connecting to the API (%s)',
1909
+ $statusCode,
1910
+ $exception->getRequest()->getUri()
1911
+ ),
1912
+ $statusCode,
1913
+ $response->getHeaders(),
1914
+ $response->getBody()
1915
+ );
1916
+ }
1917
+ );
1918
+ }
1919
+
1920
+ /**
1921
+ * Create request for operation 'sendReport'
1922
+ *
1923
+ * @param int $campaignId Id of the campaign (required)
1924
+ * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required)
1925
+ *
1926
+ * @throws \InvalidArgumentException
1927
+ * @return \GuzzleHttp\Psr7\Request
1928
+ */
1929
+ protected function sendReportRequest($campaignId, $sendReport)
1930
+ {
1931
+ // verify the required parameter 'campaignId' is set
1932
+ if ($campaignId === null) {
1933
+ throw new \InvalidArgumentException(
1934
+ 'Missing the required parameter $campaignId when calling sendReport'
1935
+ );
1936
+ }
1937
+ // verify the required parameter 'sendReport' is set
1938
+ if ($sendReport === null) {
1939
+ throw new \InvalidArgumentException(
1940
+ 'Missing the required parameter $sendReport when calling sendReport'
1941
+ );
1942
+ }
1943
+
1944
+ $resourcePath = '/emailCampaigns/{campaignId}/sendReport';
1945
+ $formParams = [];
1946
+ $queryParams = [];
1947
+ $headerParams = [];
1948
+ $httpBody = '';
1949
+ $multipart = false;
1950
+
1951
+
1952
+ // path params
1953
+ if ($campaignId !== null) {
1954
+ $resourcePath = str_replace(
1955
+ '{' . 'campaignId' . '}',
1956
+ ObjectSerializer::toPathValue($campaignId),
1957
+ $resourcePath
1958
+ );
1959
+ }
1960
+
1961
+ // body params
1962
+ $_tempBody = null;
1963
+ if (isset($sendReport)) {
1964
+ $_tempBody = $sendReport;
1965
+ }
1966
+
1967
+ if ($multipart) {
1968
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1969
+ ['application/json']
1970
+ );
1971
+ } else {
1972
+ $headers = $this->headerSelector->selectHeaders(
1973
+ ['application/json'],
1974
+ ['application/json']
1975
+ );
1976
+ }
1977
+
1978
+ // for model (json/xml)
1979
+ if (isset($_tempBody)) {
1980
+ // $_tempBody is the method argument, if present
1981
+ $httpBody = $_tempBody;
1982
+ // \stdClass has no __toString(), so we should encode it manually
1983
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1984
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1985
+ }
1986
+ } elseif (count($formParams) > 0) {
1987
+ if ($multipart) {
1988
+ $multipartContents = [];
1989
+ foreach ($formParams as $formParamName => $formParamValue) {
1990
+ $multipartContents[] = [
1991
+ 'name' => $formParamName,
1992
+ 'contents' => $formParamValue
1993
+ ];
1994
+ }
1995
+ // for HTTP post (form)
1996
+ $httpBody = new MultipartStream($multipartContents);
1997
+
1998
+ } elseif ($headers['Content-Type'] === 'application/json') {
1999
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2000
+
2001
+ } else {
2002
+ // for HTTP post (form)
2003
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2004
+ }
2005
+ }
2006
+
2007
+ // this endpoint requires API key authentication
2008
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2009
+ if ($apiKey !== null) {
2010
+ $headers['api-key'] = $apiKey;
2011
+ }
2012
+ // this endpoint requires API key authentication
2013
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2014
+ if ($apiKey !== null) {
2015
+ $headers['partner-key'] = $apiKey;
2016
+ }
2017
+
2018
+ $defaultHeaders = [];
2019
+ if ($this->config->getUserAgent()) {
2020
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2021
+ }
2022
+
2023
+ $headers = array_merge(
2024
+ $defaultHeaders,
2025
+ $headerParams,
2026
+ $headers
2027
+ );
2028
+
2029
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2030
+ return new Request(
2031
+ 'POST',
2032
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2033
+ $headers,
2034
+ $httpBody
2035
+ );
2036
+ }
2037
+
2038
+ /**
2039
+ * Operation sendTestEmail
2040
+ *
2041
+ * Send an email campaign to your test list
2042
+ *
2043
+ * @param int $campaignId Id of the campaign (required)
2044
+ * @param \SendinBlue\Client\Model\SendTestEmail $emailTo emailTo (required)
2045
+ *
2046
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2047
+ * @throws \InvalidArgumentException
2048
+ * @return void
2049
+ */
2050
+ public function sendTestEmail($campaignId, $emailTo)
2051
+ {
2052
+ $this->sendTestEmailWithHttpInfo($campaignId, $emailTo);
2053
+ }
2054
+
2055
+ /**
2056
+ * Operation sendTestEmailWithHttpInfo
2057
+ *
2058
+ * Send an email campaign to your test list
2059
+ *
2060
+ * @param int $campaignId Id of the campaign (required)
2061
+ * @param \SendinBlue\Client\Model\SendTestEmail $emailTo (required)
2062
+ *
2063
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2064
+ * @throws \InvalidArgumentException
2065
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
2066
+ */
2067
+ public function sendTestEmailWithHttpInfo($campaignId, $emailTo)
2068
+ {
2069
+ $returnType = '';
2070
+ $request = $this->sendTestEmailRequest($campaignId, $emailTo);
2071
+
2072
+ try {
2073
+ $options = $this->createHttpClientOption();
2074
+ try {
2075
+ $response = $this->client->send($request, $options);
2076
+ } catch (RequestException $e) {
2077
+ throw new ApiException(
2078
+ "[{$e->getCode()}] {$e->getMessage()}",
2079
+ $e->getCode(),
2080
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2081
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2082
+ );
2083
+ }
2084
+
2085
+ $statusCode = $response->getStatusCode();
2086
+
2087
+ if ($statusCode < 200 || $statusCode > 299) {
2088
+ throw new ApiException(
2089
+ sprintf(
2090
+ '[%d] Error connecting to the API (%s)',
2091
+ $statusCode,
2092
+ $request->getUri()
2093
+ ),
2094
+ $statusCode,
2095
+ $response->getHeaders(),
2096
+ $response->getBody()
2097
+ );
2098
+ }
2099
+
2100
+ return [null, $statusCode, $response->getHeaders()];
2101
+
2102
+ } catch (ApiException $e) {
2103
+ switch ($e->getCode()) {
2104
+ case 400:
2105
+ $data = ObjectSerializer::deserialize(
2106
+ $e->getResponseBody(),
2107
+ '\SendinBlue\Client\Model\PostSendFailed',
2108
+ $e->getResponseHeaders()
2109
+ );
2110
+ $e->setResponseObject($data);
2111
+ break;
2112
+ case 404:
2113
+ $data = ObjectSerializer::deserialize(
2114
+ $e->getResponseBody(),
2115
+ '\SendinBlue\Client\Model\ErrorModel',
2116
+ $e->getResponseHeaders()
2117
+ );
2118
+ $e->setResponseObject($data);
2119
+ break;
2120
+ }
2121
+ throw $e;
2122
+ }
2123
+ }
2124
+
2125
+ /**
2126
+ * Operation sendTestEmailAsync
2127
+ *
2128
+ * Send an email campaign to your test list
2129
+ *
2130
+ * @param int $campaignId Id of the campaign (required)
2131
+ * @param \SendinBlue\Client\Model\SendTestEmail $emailTo (required)
2132
+ *
2133
+ * @throws \InvalidArgumentException
2134
+ * @return \GuzzleHttp\Promise\PromiseInterface
2135
+ */
2136
+ public function sendTestEmailAsync($campaignId, $emailTo)
2137
+ {
2138
+ return $this->sendTestEmailAsyncWithHttpInfo($campaignId, $emailTo)
2139
+ ->then(
2140
+ function ($response) {
2141
+ return $response[0];
2142
+ }
2143
+ );
2144
+ }
2145
+
2146
+ /**
2147
+ * Operation sendTestEmailAsyncWithHttpInfo
2148
+ *
2149
+ * Send an email campaign to your test list
2150
+ *
2151
+ * @param int $campaignId Id of the campaign (required)
2152
+ * @param \SendinBlue\Client\Model\SendTestEmail $emailTo (required)
2153
+ *
2154
+ * @throws \InvalidArgumentException
2155
+ * @return \GuzzleHttp\Promise\PromiseInterface
2156
+ */
2157
+ public function sendTestEmailAsyncWithHttpInfo($campaignId, $emailTo)
2158
+ {
2159
+ $returnType = '';
2160
+ $request = $this->sendTestEmailRequest($campaignId, $emailTo);
2161
+
2162
+ return $this->client
2163
+ ->sendAsync($request, $this->createHttpClientOption())
2164
+ ->then(
2165
+ function ($response) use ($returnType) {
2166
+ return [null, $response->getStatusCode(), $response->getHeaders()];
2167
+ },
2168
+ function ($exception) {
2169
+ $response = $exception->getResponse();
2170
+ $statusCode = $response->getStatusCode();
2171
+ throw new ApiException(
2172
+ sprintf(
2173
+ '[%d] Error connecting to the API (%s)',
2174
+ $statusCode,
2175
+ $exception->getRequest()->getUri()
2176
+ ),
2177
+ $statusCode,
2178
+ $response->getHeaders(),
2179
+ $response->getBody()
2180
+ );
2181
+ }
2182
+ );
2183
+ }
2184
+
2185
+ /**
2186
+ * Create request for operation 'sendTestEmail'
2187
+ *
2188
+ * @param int $campaignId Id of the campaign (required)
2189
+ * @param \SendinBlue\Client\Model\SendTestEmail $emailTo (required)
2190
+ *
2191
+ * @throws \InvalidArgumentException
2192
+ * @return \GuzzleHttp\Psr7\Request
2193
+ */
2194
+ protected function sendTestEmailRequest($campaignId, $emailTo)
2195
+ {
2196
+ // verify the required parameter 'campaignId' is set
2197
+ if ($campaignId === null) {
2198
+ throw new \InvalidArgumentException(
2199
+ 'Missing the required parameter $campaignId when calling sendTestEmail'
2200
+ );
2201
+ }
2202
+ // verify the required parameter 'emailTo' is set
2203
+ if ($emailTo === null) {
2204
+ throw new \InvalidArgumentException(
2205
+ 'Missing the required parameter $emailTo when calling sendTestEmail'
2206
+ );
2207
+ }
2208
+
2209
+ $resourcePath = '/emailCampaigns/{campaignId}/sendTest';
2210
+ $formParams = [];
2211
+ $queryParams = [];
2212
+ $headerParams = [];
2213
+ $httpBody = '';
2214
+ $multipart = false;
2215
+
2216
+
2217
+ // path params
2218
+ if ($campaignId !== null) {
2219
+ $resourcePath = str_replace(
2220
+ '{' . 'campaignId' . '}',
2221
+ ObjectSerializer::toPathValue($campaignId),
2222
+ $resourcePath
2223
+ );
2224
+ }
2225
+
2226
+ // body params
2227
+ $_tempBody = null;
2228
+ if (isset($emailTo)) {
2229
+ $_tempBody = $emailTo;
2230
+ }
2231
+
2232
+ if ($multipart) {
2233
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2234
+ ['application/json']
2235
+ );
2236
+ } else {
2237
+ $headers = $this->headerSelector->selectHeaders(
2238
+ ['application/json'],
2239
+ ['application/json']
2240
+ );
2241
+ }
2242
+
2243
+ // for model (json/xml)
2244
+ if (isset($_tempBody)) {
2245
+ // $_tempBody is the method argument, if present
2246
+ $httpBody = $_tempBody;
2247
+ // \stdClass has no __toString(), so we should encode it manually
2248
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
2249
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
2250
+ }
2251
+ } elseif (count($formParams) > 0) {
2252
+ if ($multipart) {
2253
+ $multipartContents = [];
2254
+ foreach ($formParams as $formParamName => $formParamValue) {
2255
+ $multipartContents[] = [
2256
+ 'name' => $formParamName,
2257
+ 'contents' => $formParamValue
2258
+ ];
2259
+ }
2260
+ // for HTTP post (form)
2261
+ $httpBody = new MultipartStream($multipartContents);
2262
+
2263
+ } elseif ($headers['Content-Type'] === 'application/json') {
2264
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2265
+
2266
+ } else {
2267
+ // for HTTP post (form)
2268
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2269
+ }
2270
+ }
2271
+
2272
+ // this endpoint requires API key authentication
2273
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2274
+ if ($apiKey !== null) {
2275
+ $headers['api-key'] = $apiKey;
2276
+ }
2277
+ // this endpoint requires API key authentication
2278
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2279
+ if ($apiKey !== null) {
2280
+ $headers['partner-key'] = $apiKey;
2281
+ }
2282
+
2283
+ $defaultHeaders = [];
2284
+ if ($this->config->getUserAgent()) {
2285
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2286
+ }
2287
+
2288
+ $headers = array_merge(
2289
+ $defaultHeaders,
2290
+ $headerParams,
2291
+ $headers
2292
+ );
2293
+
2294
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2295
+ return new Request(
2296
+ 'POST',
2297
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2298
+ $headers,
2299
+ $httpBody
2300
+ );
2301
+ }
2302
+
2303
+ /**
2304
+ * Operation updateCampaignStatus
2305
+ *
2306
+ * Update a campaign status
2307
+ *
2308
+ * @param int $campaignId Id of the campaign (required)
2309
+ * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign (required)
2310
+ *
2311
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2312
+ * @throws \InvalidArgumentException
2313
+ * @return void
2314
+ */
2315
+ public function updateCampaignStatus($campaignId, $status)
2316
+ {
2317
+ $this->updateCampaignStatusWithHttpInfo($campaignId, $status);
2318
+ }
2319
+
2320
+ /**
2321
+ * Operation updateCampaignStatusWithHttpInfo
2322
+ *
2323
+ * Update a campaign status
2324
+ *
2325
+ * @param int $campaignId Id of the campaign (required)
2326
+ * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign (required)
2327
+ *
2328
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2329
+ * @throws \InvalidArgumentException
2330
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
2331
+ */
2332
+ public function updateCampaignStatusWithHttpInfo($campaignId, $status)
2333
+ {
2334
+ $returnType = '';
2335
+ $request = $this->updateCampaignStatusRequest($campaignId, $status);
2336
+
2337
+ try {
2338
+ $options = $this->createHttpClientOption();
2339
+ try {
2340
+ $response = $this->client->send($request, $options);
2341
+ } catch (RequestException $e) {
2342
+ throw new ApiException(
2343
+ "[{$e->getCode()}] {$e->getMessage()}",
2344
+ $e->getCode(),
2345
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2346
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2347
+ );
2348
+ }
2349
+
2350
+ $statusCode = $response->getStatusCode();
2351
+
2352
+ if ($statusCode < 200 || $statusCode > 299) {
2353
+ throw new ApiException(
2354
+ sprintf(
2355
+ '[%d] Error connecting to the API (%s)',
2356
+ $statusCode,
2357
+ $request->getUri()
2358
+ ),
2359
+ $statusCode,
2360
+ $response->getHeaders(),
2361
+ $response->getBody()
2362
+ );
2363
+ }
2364
+
2365
+ return [null, $statusCode, $response->getHeaders()];
2366
+
2367
+ } catch (ApiException $e) {
2368
+ switch ($e->getCode()) {
2369
+ case 400:
2370
+ $data = ObjectSerializer::deserialize(
2371
+ $e->getResponseBody(),
2372
+ '\SendinBlue\Client\Model\ErrorModel',
2373
+ $e->getResponseHeaders()
2374
+ );
2375
+ $e->setResponseObject($data);
2376
+ break;
2377
+ case 404:
2378
+ $data = ObjectSerializer::deserialize(
2379
+ $e->getResponseBody(),
2380
+ '\SendinBlue\Client\Model\ErrorModel',
2381
+ $e->getResponseHeaders()
2382
+ );
2383
+ $e->setResponseObject($data);
2384
+ break;
2385
+ }
2386
+ throw $e;
2387
+ }
2388
+ }
2389
+
2390
+ /**
2391
+ * Operation updateCampaignStatusAsync
2392
+ *
2393
+ * Update a campaign status
2394
+ *
2395
+ * @param int $campaignId Id of the campaign (required)
2396
+ * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign (required)
2397
+ *
2398
+ * @throws \InvalidArgumentException
2399
+ * @return \GuzzleHttp\Promise\PromiseInterface
2400
+ */
2401
+ public function updateCampaignStatusAsync($campaignId, $status)
2402
+ {
2403
+ return $this->updateCampaignStatusAsyncWithHttpInfo($campaignId, $status)
2404
+ ->then(
2405
+ function ($response) {
2406
+ return $response[0];
2407
+ }
2408
+ );
2409
+ }
2410
+
2411
+ /**
2412
+ * Operation updateCampaignStatusAsyncWithHttpInfo
2413
+ *
2414
+ * Update a campaign status
2415
+ *
2416
+ * @param int $campaignId Id of the campaign (required)
2417
+ * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign (required)
2418
+ *
2419
+ * @throws \InvalidArgumentException
2420
+ * @return \GuzzleHttp\Promise\PromiseInterface
2421
+ */
2422
+ public function updateCampaignStatusAsyncWithHttpInfo($campaignId, $status)
2423
+ {
2424
+ $returnType = '';
2425
+ $request = $this->updateCampaignStatusRequest($campaignId, $status);
2426
+
2427
+ return $this->client
2428
+ ->sendAsync($request, $this->createHttpClientOption())
2429
+ ->then(
2430
+ function ($response) use ($returnType) {
2431
+ return [null, $response->getStatusCode(), $response->getHeaders()];
2432
+ },
2433
+ function ($exception) {
2434
+ $response = $exception->getResponse();
2435
+ $statusCode = $response->getStatusCode();
2436
+ throw new ApiException(
2437
+ sprintf(
2438
+ '[%d] Error connecting to the API (%s)',
2439
+ $statusCode,
2440
+ $exception->getRequest()->getUri()
2441
+ ),
2442
+ $statusCode,
2443
+ $response->getHeaders(),
2444
+ $response->getBody()
2445
+ );
2446
+ }
2447
+ );
2448
+ }
2449
+
2450
+ /**
2451
+ * Create request for operation 'updateCampaignStatus'
2452
+ *
2453
+ * @param int $campaignId Id of the campaign (required)
2454
+ * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign (required)
2455
+ *
2456
+ * @throws \InvalidArgumentException
2457
+ * @return \GuzzleHttp\Psr7\Request
2458
+ */
2459
+ protected function updateCampaignStatusRequest($campaignId, $status)
2460
+ {
2461
+ // verify the required parameter 'campaignId' is set
2462
+ if ($campaignId === null) {
2463
+ throw new \InvalidArgumentException(
2464
+ 'Missing the required parameter $campaignId when calling updateCampaignStatus'
2465
+ );
2466
+ }
2467
+ // verify the required parameter 'status' is set
2468
+ if ($status === null) {
2469
+ throw new \InvalidArgumentException(
2470
+ 'Missing the required parameter $status when calling updateCampaignStatus'
2471
+ );
2472
+ }
2473
+
2474
+ $resourcePath = '/emailCampaigns/{campaignId}/status';
2475
+ $formParams = [];
2476
+ $queryParams = [];
2477
+ $headerParams = [];
2478
+ $httpBody = '';
2479
+ $multipart = false;
2480
+
2481
+
2482
+ // path params
2483
+ if ($campaignId !== null) {
2484
+ $resourcePath = str_replace(
2485
+ '{' . 'campaignId' . '}',
2486
+ ObjectSerializer::toPathValue($campaignId),
2487
+ $resourcePath
2488
+ );
2489
+ }
2490
+
2491
+ // body params
2492
+ $_tempBody = null;
2493
+ if (isset($status)) {
2494
+ $_tempBody = $status;
2495
+ }
2496
+
2497
+ if ($multipart) {
2498
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2499
+ ['application/json']
2500
+ );
2501
+ } else {
2502
+ $headers = $this->headerSelector->selectHeaders(
2503
+ ['application/json'],
2504
+ ['application/json']
2505
+ );
2506
+ }
2507
+
2508
+ // for model (json/xml)
2509
+ if (isset($_tempBody)) {
2510
+ // $_tempBody is the method argument, if present
2511
+ $httpBody = $_tempBody;
2512
+ // \stdClass has no __toString(), so we should encode it manually
2513
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
2514
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
2515
+ }
2516
+ } elseif (count($formParams) > 0) {
2517
+ if ($multipart) {
2518
+ $multipartContents = [];
2519
+ foreach ($formParams as $formParamName => $formParamValue) {
2520
+ $multipartContents[] = [
2521
+ 'name' => $formParamName,
2522
+ 'contents' => $formParamValue
2523
+ ];
2524
+ }
2525
+ // for HTTP post (form)
2526
+ $httpBody = new MultipartStream($multipartContents);
2527
+
2528
+ } elseif ($headers['Content-Type'] === 'application/json') {
2529
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2530
+
2531
+ } else {
2532
+ // for HTTP post (form)
2533
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2534
+ }
2535
+ }
2536
+
2537
+ // this endpoint requires API key authentication
2538
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2539
+ if ($apiKey !== null) {
2540
+ $headers['api-key'] = $apiKey;
2541
+ }
2542
+ // this endpoint requires API key authentication
2543
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2544
+ if ($apiKey !== null) {
2545
+ $headers['partner-key'] = $apiKey;
2546
+ }
2547
+
2548
+ $defaultHeaders = [];
2549
+ if ($this->config->getUserAgent()) {
2550
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2551
+ }
2552
+
2553
+ $headers = array_merge(
2554
+ $defaultHeaders,
2555
+ $headerParams,
2556
+ $headers
2557
+ );
2558
+
2559
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2560
+ return new Request(
2561
+ 'PUT',
2562
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2563
+ $headers,
2564
+ $httpBody
2565
+ );
2566
+ }
2567
+
2568
+ /**
2569
+ * Operation updateEmailCampaign
2570
+ *
2571
+ * Update a campaign
2572
+ *
2573
+ * @param int $campaignId Id of the campaign (required)
2574
+ * @param \SendinBlue\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required)
2575
+ *
2576
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2577
+ * @throws \InvalidArgumentException
2578
+ * @return void
2579
+ */
2580
+ public function updateEmailCampaign($campaignId, $emailCampaign)
2581
+ {
2582
+ $this->updateEmailCampaignWithHttpInfo($campaignId, $emailCampaign);
2583
+ }
2584
+
2585
+ /**
2586
+ * Operation updateEmailCampaignWithHttpInfo
2587
+ *
2588
+ * Update a campaign
2589
+ *
2590
+ * @param int $campaignId Id of the campaign (required)
2591
+ * @param \SendinBlue\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required)
2592
+ *
2593
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2594
+ * @throws \InvalidArgumentException
2595
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
2596
+ */
2597
+ public function updateEmailCampaignWithHttpInfo($campaignId, $emailCampaign)
2598
+ {
2599
+ $returnType = '';
2600
+ $request = $this->updateEmailCampaignRequest($campaignId, $emailCampaign);
2601
+
2602
+ try {
2603
+ $options = $this->createHttpClientOption();
2604
+ try {
2605
+ $response = $this->client->send($request, $options);
2606
+ } catch (RequestException $e) {
2607
+ throw new ApiException(
2608
+ "[{$e->getCode()}] {$e->getMessage()}",
2609
+ $e->getCode(),
2610
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2611
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2612
+ );
2613
+ }
2614
+
2615
+ $statusCode = $response->getStatusCode();
2616
+
2617
+ if ($statusCode < 200 || $statusCode > 299) {
2618
+ throw new ApiException(
2619
+ sprintf(
2620
+ '[%d] Error connecting to the API (%s)',
2621
+ $statusCode,
2622
+ $request->getUri()
2623
+ ),
2624
+ $statusCode,
2625
+ $response->getHeaders(),
2626
+ $response->getBody()
2627
+ );
2628
+ }
2629
+
2630
+ return [null, $statusCode, $response->getHeaders()];
2631
+
2632
+ } catch (ApiException $e) {
2633
+ switch ($e->getCode()) {
2634
+ case 400:
2635
+ $data = ObjectSerializer::deserialize(
2636
+ $e->getResponseBody(),
2637
+ '\SendinBlue\Client\Model\ErrorModel',
2638
+ $e->getResponseHeaders()
2639
+ );
2640
+ $e->setResponseObject($data);
2641
+ break;
2642
+ case 404:
2643
+ $data = ObjectSerializer::deserialize(
2644
+ $e->getResponseBody(),
2645
+ '\SendinBlue\Client\Model\ErrorModel',
2646
+ $e->getResponseHeaders()
2647
+ );
2648
+ $e->setResponseObject($data);
2649
+ break;
2650
+ }
2651
+ throw $e;
2652
+ }
2653
+ }
2654
+
2655
+ /**
2656
+ * Operation updateEmailCampaignAsync
2657
+ *
2658
+ * Update a campaign
2659
+ *
2660
+ * @param int $campaignId Id of the campaign (required)
2661
+ * @param \SendinBlue\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required)
2662
+ *
2663
+ * @throws \InvalidArgumentException
2664
+ * @return \GuzzleHttp\Promise\PromiseInterface
2665
+ */
2666
+ public function updateEmailCampaignAsync($campaignId, $emailCampaign)
2667
+ {
2668
+ return $this->updateEmailCampaignAsyncWithHttpInfo($campaignId, $emailCampaign)
2669
+ ->then(
2670
+ function ($response) {
2671
+ return $response[0];
2672
+ }
2673
+ );
2674
+ }
2675
+
2676
+ /**
2677
+ * Operation updateEmailCampaignAsyncWithHttpInfo
2678
+ *
2679
+ * Update a campaign
2680
+ *
2681
+ * @param int $campaignId Id of the campaign (required)
2682
+ * @param \SendinBlue\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required)
2683
+ *
2684
+ * @throws \InvalidArgumentException
2685
+ * @return \GuzzleHttp\Promise\PromiseInterface
2686
+ */
2687
+ public function updateEmailCampaignAsyncWithHttpInfo($campaignId, $emailCampaign)
2688
+ {
2689
+ $returnType = '';
2690
+ $request = $this->updateEmailCampaignRequest($campaignId, $emailCampaign);
2691
+
2692
+ return $this->client
2693
+ ->sendAsync($request, $this->createHttpClientOption())
2694
+ ->then(
2695
+ function ($response) use ($returnType) {
2696
+ return [null, $response->getStatusCode(), $response->getHeaders()];
2697
+ },
2698
+ function ($exception) {
2699
+ $response = $exception->getResponse();
2700
+ $statusCode = $response->getStatusCode();
2701
+ throw new ApiException(
2702
+ sprintf(
2703
+ '[%d] Error connecting to the API (%s)',
2704
+ $statusCode,
2705
+ $exception->getRequest()->getUri()
2706
+ ),
2707
+ $statusCode,
2708
+ $response->getHeaders(),
2709
+ $response->getBody()
2710
+ );
2711
+ }
2712
+ );
2713
+ }
2714
+
2715
+ /**
2716
+ * Create request for operation 'updateEmailCampaign'
2717
+ *
2718
+ * @param int $campaignId Id of the campaign (required)
2719
+ * @param \SendinBlue\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required)
2720
+ *
2721
+ * @throws \InvalidArgumentException
2722
+ * @return \GuzzleHttp\Psr7\Request
2723
+ */
2724
+ protected function updateEmailCampaignRequest($campaignId, $emailCampaign)
2725
+ {
2726
+ // verify the required parameter 'campaignId' is set
2727
+ if ($campaignId === null) {
2728
+ throw new \InvalidArgumentException(
2729
+ 'Missing the required parameter $campaignId when calling updateEmailCampaign'
2730
+ );
2731
+ }
2732
+ // verify the required parameter 'emailCampaign' is set
2733
+ if ($emailCampaign === null) {
2734
+ throw new \InvalidArgumentException(
2735
+ 'Missing the required parameter $emailCampaign when calling updateEmailCampaign'
2736
+ );
2737
+ }
2738
+
2739
+ $resourcePath = '/emailCampaigns/{campaignId}';
2740
+ $formParams = [];
2741
+ $queryParams = [];
2742
+ $headerParams = [];
2743
+ $httpBody = '';
2744
+ $multipart = false;
2745
+
2746
+
2747
+ // path params
2748
+ if ($campaignId !== null) {
2749
+ $resourcePath = str_replace(
2750
+ '{' . 'campaignId' . '}',
2751
+ ObjectSerializer::toPathValue($campaignId),
2752
+ $resourcePath
2753
+ );
2754
+ }
2755
+
2756
+ // body params
2757
+ $_tempBody = null;
2758
+ if (isset($emailCampaign)) {
2759
+ $_tempBody = $emailCampaign;
2760
+ }
2761
+
2762
+ if ($multipart) {
2763
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2764
+ ['application/json']
2765
+ );
2766
+ } else {
2767
+ $headers = $this->headerSelector->selectHeaders(
2768
+ ['application/json'],
2769
+ ['application/json']
2770
+ );
2771
+ }
2772
+
2773
+ // for model (json/xml)
2774
+ if (isset($_tempBody)) {
2775
+ // $_tempBody is the method argument, if present
2776
+ $httpBody = $_tempBody;
2777
+ // \stdClass has no __toString(), so we should encode it manually
2778
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
2779
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
2780
+ }
2781
+ } elseif (count($formParams) > 0) {
2782
+ if ($multipart) {
2783
+ $multipartContents = [];
2784
+ foreach ($formParams as $formParamName => $formParamValue) {
2785
+ $multipartContents[] = [
2786
+ 'name' => $formParamName,
2787
+ 'contents' => $formParamValue
2788
+ ];
2789
+ }
2790
+ // for HTTP post (form)
2791
+ $httpBody = new MultipartStream($multipartContents);
2792
+
2793
+ } elseif ($headers['Content-Type'] === 'application/json') {
2794
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2795
+
2796
+ } else {
2797
+ // for HTTP post (form)
2798
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2799
+ }
2800
+ }
2801
+
2802
+ // this endpoint requires API key authentication
2803
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2804
+ if ($apiKey !== null) {
2805
+ $headers['api-key'] = $apiKey;
2806
+ }
2807
+ // this endpoint requires API key authentication
2808
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2809
+ if ($apiKey !== null) {
2810
+ $headers['partner-key'] = $apiKey;
2811
+ }
2812
+
2813
+ $defaultHeaders = [];
2814
+ if ($this->config->getUserAgent()) {
2815
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2816
+ }
2817
+
2818
+ $headers = array_merge(
2819
+ $defaultHeaders,
2820
+ $headerParams,
2821
+ $headers
2822
+ );
2823
+
2824
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2825
+ return new Request(
2826
+ 'PUT',
2827
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2828
+ $headers,
2829
+ $httpBody
2830
+ );
2831
+ }
2832
+
2833
+ /**
2834
+ * Create http client option
2835
+ *
2836
+ * @throws \RuntimeException on file opening failure
2837
+ * @return array of http client options
2838
+ */
2839
+ protected function createHttpClientOption()
2840
+ {
2841
+ $options = [];
2842
+ if ($this->config->getDebug()) {
2843
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
2844
+ if (!$options[RequestOptions::DEBUG]) {
2845
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
2846
+ }
2847
+ }
2848
+
2849
+ return $options;
2850
+ }
2851
+ }
vendor/sendinblue/api-v3-sdk/lib/Api/FoldersApi.php ADDED
@@ -0,0 +1,1787 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FoldersApi
4
+ * PHP version 5
5
+ *
6
+ * @category Class
7
+ * @package SendinBlue\Client
8
+ * @author Swagger Codegen team
9
+ * @link https://github.com/swagger-api/swagger-codegen
10
+ */
11
+
12
+ /**
13
+ * SendinBlue API
14
+ *
15
+ * SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
16
+ *
17
+ * OpenAPI spec version: 3.0.0
18
+ * Contact: contact@sendinblue.com
19
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
20
+ * Swagger Codegen version: 2.3.1
21
+ */
22
+
23
+ /**
24
+ * NOTE: This class is auto generated by the swagger code generator program.
25
+ * https://github.com/swagger-api/swagger-codegen
26
+ * Do not edit the class manually.
27
+ */
28
+
29
+ namespace SendinBlue\Client\Api;
30
+
31
+ use GuzzleHttp\Client;
32
+ use GuzzleHttp\ClientInterface;
33
+ use GuzzleHttp\Exception\RequestException;
34
+ use GuzzleHttp\Psr7\MultipartStream;
35
+ use GuzzleHttp\Psr7\Request;
36
+ use GuzzleHttp\RequestOptions;
37
+ use SendinBlue\Client\ApiException;
38
+ use SendinBlue\Client\Configuration;
39
+ use SendinBlue\Client\HeaderSelector;
40
+ use SendinBlue\Client\ObjectSerializer;
41
+
42
+ /**
43
+ * FoldersApi Class Doc Comment
44
+ *
45
+ * @category Class
46
+ * @package SendinBlue\Client
47
+ * @author Swagger Codegen team
48
+ * @link https://github.com/swagger-api/swagger-codegen
49
+ */
50
+ class FoldersApi
51
+ {
52
+ /**
53
+ * @var ClientInterface
54
+ */
55
+ protected $client;
56
+
57
+ /**
58
+ * @var Configuration
59
+ */
60
+ protected $config;
61
+
62
+ /**
63
+ * @param ClientInterface $client
64
+ * @param Configuration $config
65
+ * @param HeaderSelector $selector
66
+ */
67
+ public function __construct(
68
+ ClientInterface $client = null,
69
+ Configuration $config = null,
70
+ HeaderSelector $selector = null
71
+ ) {
72
+ $this->client = $client ?: new Client();
73
+ $this->config = $config ?: new Configuration();
74
+ $this->headerSelector = $selector ?: new HeaderSelector();
75
+ }
76
+
77
+ /**
78
+ * @return Configuration
79
+ */
80
+ public function getConfig()
81
+ {
82
+ return $this->config;
83
+ }
84
+
85
+ /**
86
+ * Operation createFolder
87
+ *
88
+ * Create a folder
89
+ *
90
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required)
91
+ *
92
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
93
+ * @throws \InvalidArgumentException
94
+ * @return \SendinBlue\Client\Model\CreateModel
95
+ */
96
+ public function createFolder($createFolder)
97
+ {
98
+ list($response) = $this->createFolderWithHttpInfo($createFolder);
99
+ return $response;
100
+ }
101
+
102
+ /**
103
+ * Operation createFolderWithHttpInfo
104
+ *
105
+ * Create a folder
106
+ *
107
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required)
108
+ *
109
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
110
+ * @throws \InvalidArgumentException
111
+ * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings)
112
+ */
113
+ public function createFolderWithHttpInfo($createFolder)
114
+ {
115
+ $returnType = '\SendinBlue\Client\Model\CreateModel';
116
+ $request = $this->createFolderRequest($createFolder);
117
+
118
+ try {
119
+ $options = $this->createHttpClientOption();
120
+ try {
121
+ $response = $this->client->send($request, $options);
122
+ } catch (RequestException $e) {
123
+ throw new ApiException(
124
+ "[{$e->getCode()}] {$e->getMessage()}",
125
+ $e->getCode(),
126
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
127
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
128
+ );
129
+ }
130
+
131
+ $statusCode = $response->getStatusCode();
132
+
133
+ if ($statusCode < 200 || $statusCode > 299) {
134
+ throw new ApiException(
135
+ sprintf(
136
+ '[%d] Error connecting to the API (%s)',
137
+ $statusCode,
138
+ $request->getUri()
139
+ ),
140
+ $statusCode,
141
+ $response->getHeaders(),
142
+ $response->getBody()
143
+ );
144
+ }
145
+
146
+ $responseBody = $response->getBody();
147
+ if ($returnType === '\SplFileObject') {
148
+ $content = $responseBody; //stream goes to serializer
149
+ } else {
150
+ $content = $responseBody->getContents();
151
+ if ($returnType !== 'string') {
152
+ $content = json_decode($content);
153
+ }
154
+ }
155
+
156
+ return [
157
+ ObjectSerializer::deserialize($content, $returnType, []),
158
+ $response->getStatusCode(),
159
+ $response->getHeaders()
160
+ ];
161
+
162
+ } catch (ApiException $e) {
163
+ switch ($e->getCode()) {
164
+ case 201:
165
+ $data = ObjectSerializer::deserialize(
166
+ $e->getResponseBody(),
167
+ '\SendinBlue\Client\Model\CreateModel',
168
+ $e->getResponseHeaders()
169
+ );
170
+ $e->setResponseObject($data);
171
+ break;
172
+ case 400:
173
+ $data = ObjectSerializer::deserialize(
174
+ $e->getResponseBody(),
175
+ '\SendinBlue\Client\Model\ErrorModel',
176
+ $e->getResponseHeaders()
177
+ );
178
+ $e->setResponseObject($data);
179
+ break;
180
+ }
181
+ throw $e;
182
+ }
183
+ }
184
+
185
+ /**
186
+ * Operation createFolderAsync
187
+ *
188
+ * Create a folder
189
+ *
190
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required)
191
+ *
192
+ * @throws \InvalidArgumentException
193
+ * @return \GuzzleHttp\Promise\PromiseInterface
194
+ */
195
+ public function createFolderAsync($createFolder)
196
+ {
197
+ return $this->createFolderAsyncWithHttpInfo($createFolder)
198
+ ->then(
199
+ function ($response) {
200
+ return $response[0];
201
+ }
202
+ );
203
+ }
204
+
205
+ /**
206
+ * Operation createFolderAsyncWithHttpInfo
207
+ *
208
+ * Create a folder
209
+ *
210
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required)
211
+ *
212
+ * @throws \InvalidArgumentException
213
+ * @return \GuzzleHttp\Promise\PromiseInterface
214
+ */
215
+ public function createFolderAsyncWithHttpInfo($createFolder)
216
+ {
217
+ $returnType = '\SendinBlue\Client\Model\CreateModel';
218
+ $request = $this->createFolderRequest($createFolder);
219
+
220
+ return $this->client
221
+ ->sendAsync($request, $this->createHttpClientOption())
222
+ ->then(
223
+ function ($response) use ($returnType) {
224
+ $responseBody = $response->getBody();
225
+ if ($returnType === '\SplFileObject') {
226
+ $content = $responseBody; //stream goes to serializer
227
+ } else {
228
+ $content = $responseBody->getContents();
229
+ if ($returnType !== 'string') {
230
+ $content = json_decode($content);
231
+ }
232
+ }
233
+
234
+ return [
235
+ ObjectSerializer::deserialize($content, $returnType, []),
236
+ $response->getStatusCode(),
237
+ $response->getHeaders()
238
+ ];
239
+ },
240
+ function ($exception) {
241
+ $response = $exception->getResponse();
242
+ $statusCode = $response->getStatusCode();
243
+ throw new ApiException(
244
+ sprintf(
245
+ '[%d] Error connecting to the API (%s)',
246
+ $statusCode,
247
+ $exception->getRequest()->getUri()
248
+ ),
249
+ $statusCode,
250
+ $response->getHeaders(),
251
+ $response->getBody()
252
+ );
253
+ }
254
+ );
255
+ }
256
+
257
+ /**
258
+ * Create request for operation 'createFolder'
259
+ *
260
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required)
261
+ *
262
+ * @throws \InvalidArgumentException
263
+ * @return \GuzzleHttp\Psr7\Request
264
+ */
265
+ protected function createFolderRequest($createFolder)
266
+ {
267
+ // verify the required parameter 'createFolder' is set
268
+ if ($createFolder === null) {
269
+ throw new \InvalidArgumentException(
270
+ 'Missing the required parameter $createFolder when calling createFolder'
271
+ );
272
+ }
273
+
274
+ $resourcePath = '/contacts/folders';
275
+ $formParams = [];
276
+ $queryParams = [];
277
+ $headerParams = [];
278
+ $httpBody = '';
279
+ $multipart = false;
280
+
281
+
282
+
283
+ // body params
284
+ $_tempBody = null;
285
+ if (isset($createFolder)) {
286
+ $_tempBody = $createFolder;
287
+ }
288
+
289
+ if ($multipart) {
290
+ $headers = $this->headerSelector->selectHeadersForMultipart(
291
+ ['application/json']
292
+ );
293
+ } else {
294
+ $headers = $this->headerSelector->selectHeaders(
295
+ ['application/json'],
296
+ ['application/json']
297
+ );
298
+ }
299
+
300
+ // for model (json/xml)
301
+ if (isset($_tempBody)) {
302
+ // $_tempBody is the method argument, if present
303
+ $httpBody = $_tempBody;
304
+ // \stdClass has no __toString(), so we should encode it manually
305
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
306
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
307
+ }
308
+ } elseif (count($formParams) > 0) {
309
+ if ($multipart) {
310
+ $multipartContents = [];
311
+ foreach ($formParams as $formParamName => $formParamValue) {
312
+ $multipartContents[] = [
313
+ 'name' => $formParamName,
314
+ 'contents' => $formParamValue
315
+ ];
316
+ }
317
+ // for HTTP post (form)
318
+ $httpBody = new MultipartStream($multipartContents);
319
+
320
+ } elseif ($headers['Content-Type'] === 'application/json') {
321
+ $httpBody = \GuzzleHttp\json_encode($formParams);
322
+
323
+ } else {
324
+ // for HTTP post (form)
325
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
326
+ }
327
+ }
328
+
329
+ // this endpoint requires API key authentication
330
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
331
+ if ($apiKey !== null) {
332
+ $headers['api-key'] = $apiKey;
333
+ }
334
+ // this endpoint requires API key authentication
335
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
336
+ if ($apiKey !== null) {
337
+ $headers['partner-key'] = $apiKey;
338
+ }
339
+
340
+ $defaultHeaders = [];
341
+ if ($this->config->getUserAgent()) {
342
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
343
+ }
344
+
345
+ $headers = array_merge(
346
+ $defaultHeaders,
347
+ $headerParams,
348
+ $headers
349
+ );
350
+
351
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
352
+ return new Request(
353
+ 'POST',
354
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
355
+ $headers,
356
+ $httpBody
357
+ );
358
+ }
359
+
360
+ /**
361
+ * Operation deleteFolder
362
+ *
363
+ * Delete a folder (and all its lists)
364
+ *
365
+ * @param int $folderId Id of the folder (required)
366
+ *
367
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
368
+ * @throws \InvalidArgumentException
369
+ * @return void
370
+ */
371
+ public function deleteFolder($folderId)
372
+ {
373
+ $this->deleteFolderWithHttpInfo($folderId);
374
+ }
375
+
376
+ /**
377
+ * Operation deleteFolderWithHttpInfo
378
+ *
379
+ * Delete a folder (and all its lists)
380
+ *
381
+ * @param int $folderId Id of the folder (required)
382
+ *
383
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
384
+ * @throws \InvalidArgumentException
385
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
386
+ */
387
+ public function deleteFolderWithHttpInfo($folderId)
388
+ {
389
+ $returnType = '';
390
+ $request = $this->deleteFolderRequest($folderId);
391
+
392
+ try {
393
+ $options = $this->createHttpClientOption();
394
+ try {
395
+ $response = $this->client->send($request, $options);
396
+ } catch (RequestException $e) {
397
+ throw new ApiException(
398
+ "[{$e->getCode()}] {$e->getMessage()}",
399
+ $e->getCode(),
400
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
401
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
402
+ );
403
+ }
404
+
405
+ $statusCode = $response->getStatusCode();
406
+
407
+ if ($statusCode < 200 || $statusCode > 299) {
408
+ throw new ApiException(
409
+ sprintf(
410
+ '[%d] Error connecting to the API (%s)',
411
+ $statusCode,
412
+ $request->getUri()
413
+ ),
414
+ $statusCode,
415
+ $response->getHeaders(),
416
+ $response->getBody()
417
+ );
418
+ }
419
+
420
+ return [null, $statusCode, $response->getHeaders()];
421
+
422
+ } catch (ApiException $e) {
423
+ switch ($e->getCode()) {
424
+ case 400:
425
+ $data = ObjectSerializer::deserialize(
426
+ $e->getResponseBody(),
427
+ '\SendinBlue\Client\Model\ErrorModel',
428
+ $e->getResponseHeaders()
429
+ );
430
+ $e->setResponseObject($data);
431
+ break;
432
+ case 404:
433
+ $data = ObjectSerializer::deserialize(
434
+ $e->getResponseBody(),
435
+ '\SendinBlue\Client\Model\ErrorModel',
436
+ $e->getResponseHeaders()
437
+ );
438
+ $e->setResponseObject($data);
439
+ break;
440
+ }
441
+ throw $e;
442
+ }
443
+ }
444
+
445
+ /**
446
+ * Operation deleteFolderAsync
447
+ *
448
+ * Delete a folder (and all its lists)
449
+ *
450
+ * @param int $folderId Id of the folder (required)
451
+ *
452
+ * @throws \InvalidArgumentException
453
+ * @return \GuzzleHttp\Promise\PromiseInterface
454
+ */
455
+ public function deleteFolderAsync($folderId)
456
+ {
457
+ return $this->deleteFolderAsyncWithHttpInfo($folderId)
458
+ ->then(
459
+ function ($response) {
460
+ return $response[0];
461
+ }
462
+ );
463
+ }
464
+
465
+ /**
466
+ * Operation deleteFolderAsyncWithHttpInfo
467
+ *
468
+ * Delete a folder (and all its lists)
469
+ *
470
+ * @param int $folderId Id of the folder (required)
471
+ *
472
+ * @throws \InvalidArgumentException
473
+ * @return \GuzzleHttp\Promise\PromiseInterface
474
+ */
475
+ public function deleteFolderAsyncWithHttpInfo($folderId)
476
+ {
477
+ $returnType = '';
478
+ $request = $this->deleteFolderRequest($folderId);
479
+
480
+ return $this->client
481
+ ->sendAsync($request, $this->createHttpClientOption())
482
+ ->then(
483
+ function ($response) use ($returnType) {
484
+ return [null, $response->getStatusCode(), $response->getHeaders()];
485
+ },
486
+ function ($exception) {
487
+ $response = $exception->getResponse();
488
+ $statusCode = $response->getStatusCode();
489
+ throw new ApiException(
490
+ sprintf(
491
+ '[%d] Error connecting to the API (%s)',
492
+ $statusCode,
493
+ $exception->getRequest()->getUri()
494
+ ),
495
+ $statusCode,
496
+ $response->getHeaders(),
497
+ $response->getBody()
498
+ );
499
+ }
500
+ );
501
+ }
502
+
503
+ /**
504
+ * Create request for operation 'deleteFolder'
505
+ *
506
+ * @param int $folderId Id of the folder (required)
507
+ *
508
+ * @throws \InvalidArgumentException
509
+ * @return \GuzzleHttp\Psr7\Request
510
+ */
511
+ protected function deleteFolderRequest($folderId)
512
+ {
513
+ // verify the required parameter 'folderId' is set
514
+ if ($folderId === null) {
515
+ throw new \InvalidArgumentException(
516
+ 'Missing the required parameter $folderId when calling deleteFolder'
517
+ );
518
+ }
519
+
520
+ $resourcePath = '/contacts/folders/{folderId}';
521
+ $formParams = [];
522
+ $queryParams = [];
523
+ $headerParams = [];
524
+ $httpBody = '';
525
+ $multipart = false;
526
+
527
+
528
+ // path params
529
+ if ($folderId !== null) {
530
+ $resourcePath = str_replace(
531
+ '{' . 'folderId' . '}',
532
+ ObjectSerializer::toPathValue($folderId),
533
+ $resourcePath
534
+ );
535
+ }
536
+
537
+ // body params
538
+ $_tempBody = null;
539
+
540
+ if ($multipart) {
541
+ $headers = $this->headerSelector->selectHeadersForMultipart(
542
+ ['application/json']
543
+ );
544
+ } else {
545
+ $headers = $this->headerSelector->selectHeaders(
546
+ ['application/json'],
547
+ ['application/json']
548
+ );
549
+ }
550
+
551
+ // for model (json/xml)
552
+ if (isset($_tempBody)) {
553
+ // $_tempBody is the method argument, if present
554
+ $httpBody = $_tempBody;
555
+ // \stdClass has no __toString(), so we should encode it manually
556
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
557
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
558
+ }
559
+ } elseif (count($formParams) > 0) {
560
+ if ($multipart) {
561
+ $multipartContents = [];
562
+ foreach ($formParams as $formParamName => $formParamValue) {
563
+ $multipartContents[] = [
564
+ 'name' => $formParamName,
565
+ 'contents' => $formParamValue
566
+ ];
567
+ }
568
+ // for HTTP post (form)
569
+ $httpBody = new MultipartStream($multipartContents);
570
+
571
+ } elseif ($headers['Content-Type'] === 'application/json') {
572
+ $httpBody = \GuzzleHttp\json_encode($formParams);
573
+
574
+ } else {
575
+ // for HTTP post (form)
576
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
577
+ }
578
+ }
579
+
580
+ // this endpoint requires API key authentication
581
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
582
+ if ($apiKey !== null) {
583
+ $headers['api-key'] = $apiKey;
584
+ }
585
+ // this endpoint requires API key authentication
586
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
587
+ if ($apiKey !== null) {
588
+ $headers['partner-key'] = $apiKey;
589
+ }
590
+
591
+ $defaultHeaders = [];
592
+ if ($this->config->getUserAgent()) {
593
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
594
+ }
595
+
596
+ $headers = array_merge(
597
+ $defaultHeaders,
598
+ $headerParams,
599
+ $headers
600
+ );
601
+
602
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
603
+ return new Request(
604
+ 'DELETE',
605
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
606
+ $headers,
607
+ $httpBody
608
+ );
609
+ }
610
+
611
+ /**
612
+ * Operation getFolder
613
+ *
614
+ * Returns folder details
615
+ *
616
+ * @param int $folderId id of the folder (required)
617
+ *
618
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
619
+ * @throws \InvalidArgumentException
620
+ * @return \SendinBlue\Client\Model\GetFolder
621
+ */
622
+ public function getFolder($folderId)
623
+ {
624
+ list($response) = $this->getFolderWithHttpInfo($folderId);
625
+ return $response;
626
+ }
627
+
628
+ /**
629
+ * Operation getFolderWithHttpInfo
630
+ *
631
+ * Returns folder details
632
+ *
633
+ * @param int $folderId id of the folder (required)
634
+ *
635
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
636
+ * @throws \InvalidArgumentException
637
+ * @return array of \SendinBlue\Client\Model\GetFolder, HTTP status code, HTTP response headers (array of strings)
638
+ */
639
+ public function getFolderWithHttpInfo($folderId)
640
+ {
641
+ $returnType = '\SendinBlue\Client\Model\GetFolder';
642
+ $request = $this->getFolderRequest($folderId);
643
+
644
+ try {
645
+ $options = $this->createHttpClientOption();
646
+ try {
647
+ $response = $this->client->send($request, $options);
648
+ } catch (RequestException $e) {
649
+ throw new ApiException(
650
+ "[{$e->getCode()}] {$e->getMessage()}",
651
+ $e->getCode(),
652
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
653
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
654
+ );
655
+ }
656
+
657
+ $statusCode = $response->getStatusCode();
658
+
659
+ if ($statusCode < 200 || $statusCode > 299) {
660
+ throw new ApiException(
661
+ sprintf(
662
+ '[%d] Error connecting to the API (%s)',
663
+ $statusCode,
664
+ $request->getUri()
665
+ ),
666
+ $statusCode,
667
+ $response->getHeaders(),
668
+ $response->getBody()
669
+ );
670
+ }
671
+
672
+ $responseBody = $response->getBody();
673
+ if ($returnType === '\SplFileObject') {
674
+ $content = $responseBody; //stream goes to serializer
675
+ } else {
676
+ $content = $responseBody->getContents();
677
+ if ($returnType !== 'string') {
678
+ $content = json_decode($content);
679
+ }
680
+ }
681
+
682
+ return [
683
+ ObjectSerializer::deserialize($content, $returnType, []),
684
+ $response->getStatusCode(),
685
+ $response->getHeaders()
686
+ ];
687
+
688
+ } catch (ApiException $e) {
689
+ switch ($e->getCode()) {
690
+ case 200:
691
+ $data = ObjectSerializer::deserialize(
692
+ $e->getResponseBody(),
693
+ '\SendinBlue\Client\Model\GetFolder',
694
+ $e->getResponseHeaders()
695
+ );
696
+ $e->setResponseObject($data);
697
+ break;
698
+ case 400:
699
+ $data = ObjectSerializer::deserialize(
700
+ $e->getResponseBody(),
701
+ '\SendinBlue\Client\Model\ErrorModel',
702
+ $e->getResponseHeaders()
703
+ );
704
+ $e->setResponseObject($data);
705
+ break;
706
+ case 404:
707
+ $data = ObjectSerializer::deserialize(
708
+ $e->getResponseBody(),
709
+ '\SendinBlue\Client\Model\ErrorModel',
710
+ $e->getResponseHeaders()
711
+ );
712
+ $e->setResponseObject($data);
713
+ break;
714
+ }
715
+ throw $e;
716
+ }
717
+ }
718
+
719
+ /**
720
+ * Operation getFolderAsync
721
+ *
722
+ * Returns folder details
723
+ *
724
+ * @param int $folderId id of the folder (required)
725
+ *
726
+ * @throws \InvalidArgumentException
727
+ * @return \GuzzleHttp\Promise\PromiseInterface
728
+ */
729
+ public function getFolderAsync($folderId)
730
+ {
731
+ return $this->getFolderAsyncWithHttpInfo($folderId)
732
+ ->then(
733
+ function ($response) {
734
+ return $response[0];
735
+ }
736
+ );
737
+ }
738
+
739
+ /**
740
+ * Operation getFolderAsyncWithHttpInfo
741
+ *
742
+ * Returns folder details
743
+ *
744
+ * @param int $folderId id of the folder (required)
745
+ *
746
+ * @throws \InvalidArgumentException
747
+ * @return \GuzzleHttp\Promise\PromiseInterface
748
+ */
749
+ public function getFolderAsyncWithHttpInfo($folderId)
750
+ {
751
+ $returnType = '\SendinBlue\Client\Model\GetFolder';
752
+ $request = $this->getFolderRequest($folderId);
753
+
754
+ return $this->client
755
+ ->sendAsync($request, $this->createHttpClientOption())
756
+ ->then(
757
+ function ($response) use ($returnType) {
758
+ $responseBody = $response->getBody();
759
+ if ($returnType === '\SplFileObject') {
760
+ $content = $responseBody; //stream goes to serializer
761
+ } else {
762
+ $content = $responseBody->getContents();
763
+ if ($returnType !== 'string') {
764
+ $content = json_decode($content);
765
+ }
766
+ }
767
+
768
+ return [
769
+ ObjectSerializer::deserialize($content, $returnType, []),
770
+ $response->getStatusCode(),
771
+ $response->getHeaders()
772
+ ];
773
+ },
774
+ function ($exception) {
775
+ $response = $exception->getResponse();
776
+ $statusCode = $response->getStatusCode();
777
+ throw new ApiException(
778
+ sprintf(
779
+ '[%d] Error connecting to the API (%s)',
780
+ $statusCode,
781
+ $exception->getRequest()->getUri()
782
+ ),
783
+ $statusCode,
784
+ $response->getHeaders(),
785
+ $response->getBody()
786
+ );
787
+ }
788
+ );
789
+ }
790
+
791
+ /**
792
+ * Create request for operation 'getFolder'
793
+ *
794
+ * @param int $folderId id of the folder (required)
795
+ *
796
+ * @throws \InvalidArgumentException
797
+ * @return \GuzzleHttp\Psr7\Request
798
+ */
799
+ protected function getFolderRequest($folderId)
800
+ {
801
+ // verify the required parameter 'folderId' is set
802
+ if ($folderId === null) {
803
+ throw new \InvalidArgumentException(
804
+ 'Missing the required parameter $folderId when calling getFolder'
805
+ );
806
+ }
807
+
808
+ $resourcePath = '/contacts/folders/{folderId}';
809
+ $formParams = [];
810
+ $queryParams = [];
811
+ $headerParams = [];
812
+ $httpBody = '';
813
+ $multipart = false;
814
+
815
+
816
+ // path params
817
+ if ($folderId !== null) {
818
+ $resourcePath = str_replace(
819
+ '{' . 'folderId' . '}',
820
+ ObjectSerializer::toPathValue($folderId),
821
+ $resourcePath
822
+ );
823
+ }
824
+
825
+ // body params
826
+ $_tempBody = null;
827
+
828
+ if ($multipart) {
829
+ $headers = $this->headerSelector->selectHeadersForMultipart(
830
+ ['application/json']
831
+ );
832
+ } else {
833
+ $headers = $this->headerSelector->selectHeaders(
834
+ ['application/json'],
835
+ ['application/json']
836
+ );
837
+ }
838
+
839
+ // for model (json/xml)
840
+ if (isset($_tempBody)) {
841
+ // $_tempBody is the method argument, if present
842
+ $httpBody = $_tempBody;
843
+ // \stdClass has no __toString(), so we should encode it manually
844
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
845
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
846
+ }
847
+ } elseif (count($formParams) > 0) {
848
+ if ($multipart) {
849
+ $multipartContents = [];
850
+ foreach ($formParams as $formParamName => $formParamValue) {
851
+ $multipartContents[] = [
852
+ 'name' => $formParamName,
853
+ 'contents' => $formParamValue
854
+ ];
855
+ }
856
+ // for HTTP post (form)
857
+ $httpBody = new MultipartStream($multipartContents);
858
+
859
+ } elseif ($headers['Content-Type'] === 'application/json') {
860
+ $httpBody = \GuzzleHttp\json_encode($formParams);
861
+
862
+ } else {
863
+ // for HTTP post (form)
864
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
865
+ }
866
+ }
867
+
868
+ // this endpoint requires API key authentication
869
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
870
+ if ($apiKey !== null) {
871
+ $headers['api-key'] = $apiKey;
872
+ }
873
+ // this endpoint requires API key authentication
874
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
875
+ if ($apiKey !== null) {
876
+ $headers['partner-key'] = $apiKey;
877
+ }
878
+
879
+ $defaultHeaders = [];
880
+ if ($this->config->getUserAgent()) {
881
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
882
+ }
883
+
884
+ $headers = array_merge(
885
+ $defaultHeaders,
886
+ $headerParams,
887
+ $headers
888
+ );
889
+
890
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
891
+ return new Request(
892
+ 'GET',
893
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
894
+ $headers,
895
+ $httpBody
896
+ );
897
+ }
898
+
899
+ /**
900
+ * Operation getFolderLists
901
+ *
902
+ * Get the lists in a folder
903
+ *
904
+ * @param int $folderId Id of the folder (required)
905
+ * @param int $limit Number of documents per page (optional, default to 10)
906
+ * @param int $offset Index of the first document of the page (optional, default to 0)
907
+ *
908
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
909
+ * @throws \InvalidArgumentException
910
+ * @return \SendinBlue\Client\Model\GetFolderLists
911
+ */
912
+ public function getFolderLists($folderId, $limit = '10', $offset = '0')
913
+ {
914
+ list($response) = $this->getFolderListsWithHttpInfo($folderId, $limit, $offset);
915
+ return $response;
916
+ }
917
+
918
+ /**
919
+ * Operation getFolderListsWithHttpInfo
920
+ *
921
+ * Get the lists in a folder
922
+ *
923
+ * @param int $folderId Id of the folder (required)
924
+ * @param int $limit Number of documents per page (optional, default to 10)
925
+ * @param int $offset Index of the first document of the page (optional, default to 0)
926
+ *
927
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
928
+ * @throws \InvalidArgumentException
929
+ * @return array of \SendinBlue\Client\Model\GetFolderLists, HTTP status code, HTTP response headers (array of strings)
930
+ */
931
+ public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = '0')
932
+ {
933
+ $returnType = '\SendinBlue\Client\Model\GetFolderLists';
934
+ $request = $this->getFolderListsRequest($folderId, $limit, $offset);
935
+
936
+ try {
937
+ $options = $this->createHttpClientOption();
938
+ try {
939
+ $response = $this->client->send($request, $options);
940
+ } catch (RequestException $e) {
941
+ throw new ApiException(
942
+ "[{$e->getCode()}] {$e->getMessage()}",
943
+ $e->getCode(),
944
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
945
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
946
+ );
947
+ }
948
+
949
+ $statusCode = $response->getStatusCode();
950
+
951
+ if ($statusCode < 200 || $statusCode > 299) {
952
+ throw new ApiException(
953
+ sprintf(
954
+ '[%d] Error connecting to the API (%s)',
955
+ $statusCode,
956
+ $request->getUri()
957
+ ),
958
+ $statusCode,
959
+ $response->getHeaders(),
960
+ $response->getBody()
961
+ );
962
+ }
963
+
964
+ $responseBody = $response->getBody();
965
+ if ($returnType === '\SplFileObject') {
966
+ $content = $responseBody; //stream goes to serializer
967
+ } else {
968
+ $content = $responseBody->getContents();
969
+ if ($returnType !== 'string') {
970
+ $content = json_decode($content);
971
+ }
972
+ }
973
+
974
+ return [
975
+ ObjectSerializer::deserialize($content, $returnType, []),
976
+ $response->getStatusCode(),
977
+ $response->getHeaders()
978
+ ];
979
+
980
+ } catch (ApiException $e) {
981
+ switch ($e->getCode()) {
982
+ case 200:
983
+ $data = ObjectSerializer::deserialize(
984
+ $e->getResponseBody(),
985
+ '\SendinBlue\Client\Model\GetFolderLists',
986
+ $e->getResponseHeaders()
987
+ );
988
+ $e->setResponseObject($data);
989
+ break;
990
+ case 400:
991
+ $data = ObjectSerializer::deserialize(
992
+ $e->getResponseBody(),
993
+ '\SendinBlue\Client\Model\ErrorModel',
994
+ $e->getResponseHeaders()
995
+ );
996
+ $e->setResponseObject($data);
997
+ break;
998
+ case 404:
999
+ $data = ObjectSerializer::deserialize(
1000
+ $e->getResponseBody(),
1001
+ '\SendinBlue\Client\Model\ErrorModel',
1002
+ $e->getResponseHeaders()
1003
+ );
1004
+ $e->setResponseObject($data);
1005
+ break;
1006
+ }
1007
+ throw $e;
1008
+ }
1009
+ }
1010
+
1011
+ /**
1012
+ * Operation getFolderListsAsync
1013
+ *
1014
+ * Get the lists in a folder
1015
+ *
1016
+ * @param int $folderId Id of the folder (required)
1017
+ * @param int $limit Number of documents per page (optional, default to 10)
1018
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1019
+ *
1020
+ * @throws \InvalidArgumentException
1021
+ * @return \GuzzleHttp\Promise\PromiseInterface
1022
+ */
1023
+ public function getFolderListsAsync($folderId, $limit = '10', $offset = '0')
1024
+ {
1025
+ return $this->getFolderListsAsyncWithHttpInfo($folderId, $limit, $offset)
1026
+ ->then(
1027
+ function ($response) {
1028
+ return $response[0];
1029
+ }
1030
+ );
1031
+ }
1032
+
1033
+ /**
1034
+ * Operation getFolderListsAsyncWithHttpInfo
1035
+ *
1036
+ * Get the lists in a folder
1037
+ *
1038
+ * @param int $folderId Id of the folder (required)
1039
+ * @param int $limit Number of documents per page (optional, default to 10)
1040
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1041
+ *
1042
+ * @throws \InvalidArgumentException
1043
+ * @return \GuzzleHttp\Promise\PromiseInterface
1044
+ */
1045
+ public function getFolderListsAsyncWithHttpInfo($folderId, $limit = '10', $offset = '0')
1046
+ {
1047
+ $returnType = '\SendinBlue\Client\Model\GetFolderLists';
1048
+ $request = $this->getFolderListsRequest($folderId, $limit, $offset);
1049
+
1050
+ return $this->client
1051
+ ->sendAsync($request, $this->createHttpClientOption())
1052
+ ->then(
1053
+ function ($response) use ($returnType) {
1054
+ $responseBody = $response->getBody();
1055
+ if ($returnType === '\SplFileObject') {
1056
+ $content = $responseBody; //stream goes to serializer
1057
+ } else {
1058
+ $content = $responseBody->getContents();
1059
+ if ($returnType !== 'string') {
1060
+ $content = json_decode($content);
1061
+ }
1062
+ }
1063
+
1064
+ return [
1065
+ ObjectSerializer::deserialize($content, $returnType, []),
1066
+ $response->getStatusCode(),
1067
+ $response->getHeaders()
1068
+ ];
1069
+ },
1070
+ function ($exception) {
1071
+ $response = $exception->getResponse();
1072
+ $statusCode = $response->getStatusCode();
1073
+ throw new ApiException(
1074
+ sprintf(
1075
+ '[%d] Error connecting to the API (%s)',
1076
+ $statusCode,
1077
+ $exception->getRequest()->getUri()
1078
+ ),
1079
+ $statusCode,
1080
+ $response->getHeaders(),
1081
+ $response->getBody()
1082
+ );
1083
+ }
1084
+ );
1085
+ }
1086
+
1087
+ /**
1088
+ * Create request for operation 'getFolderLists'
1089
+ *
1090
+ * @param int $folderId Id of the folder (required)
1091
+ * @param int $limit Number of documents per page (optional, default to 10)
1092
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1093
+ *
1094
+ * @throws \InvalidArgumentException
1095
+ * @return \GuzzleHttp\Psr7\Request
1096
+ */
1097
+ protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0')
1098
+ {
1099
+ // verify the required parameter 'folderId' is set
1100
+ if ($folderId === null) {
1101
+ throw new \InvalidArgumentException(
1102
+ 'Missing the required parameter $folderId when calling getFolderLists'
1103
+ );
1104
+ }
1105
+ if ($limit !== null && $limit > 50) {
1106
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling FoldersApi.getFolderLists, must be smaller than or equal to 50.');
1107
+ }
1108
+
1109
+
1110
+ $resourcePath = '/contacts/folders/{folderId}/lists';
1111
+ $formParams = [];
1112
+ $queryParams = [];
1113
+ $headerParams = [];
1114
+ $httpBody = '';
1115
+ $multipart = false;
1116
+
1117
+ // query params
1118
+ if ($limit !== null) {
1119
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
1120
+ }
1121
+ // query params
1122
+ if ($offset !== null) {
1123
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
1124
+ }
1125
+
1126
+ // path params
1127
+ if ($folderId !== null) {
1128
+ $resourcePath = str_replace(
1129
+ '{' . 'folderId' . '}',
1130
+ ObjectSerializer::toPathValue($folderId),
1131
+ $resourcePath
1132
+ );
1133
+ }
1134
+
1135
+ // body params
1136
+ $_tempBody = null;
1137
+
1138
+ if ($multipart) {
1139
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1140
+ ['application/json']
1141
+ );
1142
+ } else {
1143
+ $headers = $this->headerSelector->selectHeaders(
1144
+ ['application/json'],
1145
+ ['application/json']
1146
+ );
1147
+ }
1148
+
1149
+ // for model (json/xml)
1150
+ if (isset($_tempBody)) {
1151
+ // $_tempBody is the method argument, if present
1152
+ $httpBody = $_tempBody;
1153
+ // \stdClass has no __toString(), so we should encode it manually
1154
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1155
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1156
+ }
1157
+ } elseif (count($formParams) > 0) {
1158
+ if ($multipart) {
1159
+ $multipartContents = [];
1160
+ foreach ($formParams as $formParamName => $formParamValue) {
1161
+ $multipartContents[] = [
1162
+ 'name' => $formParamName,
1163
+ 'contents' => $formParamValue
1164
+ ];
1165
+ }
1166
+ // for HTTP post (form)
1167
+ $httpBody = new MultipartStream($multipartContents);
1168
+
1169
+ } elseif ($headers['Content-Type'] === 'application/json') {
1170
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1171
+
1172
+ } else {
1173
+ // for HTTP post (form)
1174
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1175
+ }
1176
+ }
1177
+
1178
+ // this endpoint requires API key authentication
1179
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1180
+ if ($apiKey !== null) {
1181
+ $headers['api-key'] = $apiKey;
1182
+ }
1183
+ // this endpoint requires API key authentication
1184
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1185
+ if ($apiKey !== null) {
1186
+ $headers['partner-key'] = $apiKey;
1187
+ }
1188
+
1189
+ $defaultHeaders = [];
1190
+ if ($this->config->getUserAgent()) {
1191
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1192
+ }
1193
+
1194
+ $headers = array_merge(
1195
+ $defaultHeaders,
1196
+ $headerParams,
1197
+ $headers
1198
+ );
1199
+
1200
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1201
+ return new Request(
1202
+ 'GET',
1203
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1204
+ $headers,
1205
+ $httpBody
1206
+ );
1207
+ }
1208
+
1209
+ /**
1210
+ * Operation getFolders
1211
+ *
1212
+ * Get all the folders
1213
+ *
1214
+ * @param int $limit Number of documents per page (required)
1215
+ * @param int $offset Index of the first document of the page (required)
1216
+ *
1217
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1218
+ * @throws \InvalidArgumentException
1219
+ * @return \SendinBlue\Client\Model\GetFolders
1220
+ */
1221
+ public function getFolders($limit, $offset)
1222
+ {
1223
+ list($response) = $this->getFoldersWithHttpInfo($limit, $offset);
1224
+ return $response;
1225
+ }
1226
+
1227
+ /**
1228
+ * Operation getFoldersWithHttpInfo
1229
+ *
1230
+ * Get all the folders
1231
+ *
1232
+ * @param int $limit Number of documents per page (required)
1233
+ * @param int $offset Index of the first document of the page (required)
1234
+ *
1235
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1236
+ * @throws \InvalidArgumentException
1237
+ * @return array of \SendinBlue\Client\Model\GetFolders, HTTP status code, HTTP response headers (array of strings)
1238
+ */
1239
+ public function getFoldersWithHttpInfo($limit, $offset)
1240
+ {
1241
+ $returnType = '\SendinBlue\Client\Model\GetFolders';
1242
+ $request = $this->getFoldersRequest($limit, $offset);
1243
+
1244
+ try {
1245
+ $options = $this->createHttpClientOption();
1246
+ try {
1247
+ $response = $this->client->send($request, $options);
1248
+ } catch (RequestException $e) {
1249
+ throw new ApiException(
1250
+ "[{$e->getCode()}] {$e->getMessage()}",
1251
+ $e->getCode(),
1252
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1253
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1254
+ );
1255
+ }
1256
+
1257
+ $statusCode = $response->getStatusCode();
1258
+
1259
+ if ($statusCode < 200 || $statusCode > 299) {
1260
+ throw new ApiException(
1261
+ sprintf(
1262
+ '[%d] Error connecting to the API (%s)',
1263
+ $statusCode,
1264
+ $request->getUri()
1265
+ ),
1266
+ $statusCode,
1267
+ $response->getHeaders(),
1268
+ $response->getBody()
1269
+ );
1270
+ }
1271
+
1272
+ $responseBody = $response->getBody();
1273
+ if ($returnType === '\SplFileObject') {
1274
+ $content = $responseBody; //stream goes to serializer
1275
+ } else {
1276
+ $content = $responseBody->getContents();
1277
+ if ($returnType !== 'string') {
1278
+ $content = json_decode($content);
1279
+ }
1280
+ }
1281
+
1282
+ return [
1283
+ ObjectSerializer::deserialize($content, $returnType, []),
1284
+ $response->getStatusCode(),
1285
+ $response->getHeaders()
1286
+ ];
1287
+
1288
+ } catch (ApiException $e) {
1289
+ switch ($e->getCode()) {
1290
+ case 200:
1291
+ $data = ObjectSerializer::deserialize(
1292
+ $e->getResponseBody(),
1293
+ '\SendinBlue\Client\Model\GetFolders',
1294
+ $e->getResponseHeaders()
1295
+ );
1296
+ $e->setResponseObject($data);
1297
+ break;
1298
+ case 400:
1299
+ $data = ObjectSerializer::deserialize(
1300
+ $e->getResponseBody(),
1301
+ '\SendinBlue\Client\Model\ErrorModel',
1302
+ $e->getResponseHeaders()
1303
+ );
1304
+ $e->setResponseObject($data);
1305
+ break;
1306
+ }
1307
+ throw $e;
1308
+ }
1309
+ }
1310
+
1311
+ /**
1312
+ * Operation getFoldersAsync
1313
+ *
1314
+ * Get all the folders
1315
+ *
1316
+ * @param int $limit Number of documents per page (required)
1317
+ * @param int $offset Index of the first document of the page (required)
1318
+ *
1319
+ * @throws \InvalidArgumentException
1320
+ * @return \GuzzleHttp\Promise\PromiseInterface
1321
+ */
1322
+ public function getFoldersAsync($limit, $offset)
1323
+ {
1324
+ return $this->getFoldersAsyncWithHttpInfo($limit, $offset)
1325
+ ->then(
1326
+ function ($response) {
1327
+ return $response[0];
1328
+ }
1329
+ );
1330
+ }
1331
+
1332
+ /**
1333
+ * Operation getFoldersAsyncWithHttpInfo
1334
+ *
1335
+ * Get all the folders
1336
+ *
1337
+ * @param int $limit Number of documents per page (required)
1338
+ * @param int $offset Index of the first document of the page (required)
1339
+ *
1340
+ * @throws \InvalidArgumentException
1341
+ * @return \GuzzleHttp\Promise\PromiseInterface
1342
+ */
1343
+ public function getFoldersAsyncWithHttpInfo($limit, $offset)
1344
+ {
1345
+ $returnType = '\SendinBlue\Client\Model\GetFolders';
1346
+ $request = $this->getFoldersRequest($limit, $offset);
1347
+
1348
+ return $this->client
1349
+ ->sendAsync($request, $this->createHttpClientOption())
1350
+ ->then(
1351
+ function ($response) use ($returnType) {
1352
+ $responseBody = $response->getBody();
1353
+ if ($returnType === '\SplFileObject') {
1354
+ $content = $responseBody; //stream goes to serializer
1355
+ } else {
1356
+ $content = $responseBody->getContents();
1357
+ if ($returnType !== 'string') {
1358
+ $content = json_decode($content);
1359
+ }
1360
+ }
1361
+
1362
+ return [
1363
+ ObjectSerializer::deserialize($content, $returnType, []),
1364
+ $response->getStatusCode(),
1365
+ $response->getHeaders()
1366
+ ];
1367
+ },
1368
+ function ($exception) {
1369
+ $response = $exception->getResponse();
1370
+ $statusCode = $response->getStatusCode();
1371
+ throw new ApiException(
1372
+ sprintf(
1373
+ '[%d] Error connecting to the API (%s)',
1374
+ $statusCode,
1375
+ $exception->getRequest()->getUri()
1376
+ ),
1377
+ $statusCode,
1378
+ $response->getHeaders(),
1379
+ $response->getBody()
1380
+ );
1381
+ }
1382
+ );
1383
+ }
1384
+
1385
+ /**
1386
+ * Create request for operation 'getFolders'
1387
+ *
1388
+ * @param int $limit Number of documents per page (required)
1389
+ * @param int $offset Index of the first document of the page (required)
1390
+ *
1391
+ * @throws \InvalidArgumentException
1392
+ * @return \GuzzleHttp\Psr7\Request
1393
+ */
1394
+ protected function getFoldersRequest($limit, $offset)
1395
+ {
1396
+ // verify the required parameter 'limit' is set
1397
+ if ($limit === null) {
1398
+ throw new \InvalidArgumentException(
1399
+ 'Missing the required parameter $limit when calling getFolders'
1400
+ );
1401
+ }
1402
+ if ($limit > 50) {
1403
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling FoldersApi.getFolders, must be smaller than or equal to 50.');
1404
+ }
1405
+
1406
+ // verify the required parameter 'offset' is set
1407
+ if ($offset === null) {
1408
+ throw new \InvalidArgumentException(
1409
+ 'Missing the required parameter $offset when calling getFolders'
1410
+ );
1411
+ }
1412
+
1413
+ $resourcePath = '/contacts/folders';
1414
+ $formParams = [];
1415
+ $queryParams = [];
1416
+ $headerParams = [];
1417
+ $httpBody = '';
1418
+ $multipart = false;
1419
+
1420
+ // query params
1421
+ if ($limit !== null) {
1422
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
1423
+ }
1424
+ // query params
1425
+ if ($offset !== null) {
1426
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
1427
+ }
1428
+
1429
+
1430
+ // body params
1431
+ $_tempBody = null;
1432
+
1433
+ if ($multipart) {
1434
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1435
+ ['application/json']
1436
+ );
1437
+ } else {
1438
+ $headers = $this->headerSelector->selectHeaders(
1439
+ ['application/json'],
1440
+ ['application/json']
1441
+ );
1442
+ }
1443
+
1444
+ // for model (json/xml)
1445
+ if (isset($_tempBody)) {
1446
+ // $_tempBody is the method argument, if present
1447
+ $httpBody = $_tempBody;
1448
+ // \stdClass has no __toString(), so we should encode it manually
1449
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1450
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1451
+ }
1452
+ } elseif (count($formParams) > 0) {
1453
+ if ($multipart) {
1454
+ $multipartContents = [];
1455
+ foreach ($formParams as $formParamName => $formParamValue) {
1456
+ $multipartContents[] = [
1457
+ 'name' => $formParamName,
1458
+ 'contents' => $formParamValue
1459
+ ];
1460
+ }
1461
+ // for HTTP post (form)
1462
+ $httpBody = new MultipartStream($multipartContents);
1463
+
1464
+ } elseif ($headers['Content-Type'] === 'application/json') {
1465
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1466
+
1467
+ } else {
1468
+ // for HTTP post (form)
1469
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1470
+ }
1471
+ }
1472
+
1473
+ // this endpoint requires API key authentication
1474
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1475
+ if ($apiKey !== null) {
1476
+ $headers['api-key'] = $apiKey;
1477
+ }
1478
+ // this endpoint requires API key authentication
1479
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1480
+ if ($apiKey !== null) {
1481
+ $headers['partner-key'] = $apiKey;
1482
+ }
1483
+
1484
+ $defaultHeaders = [];
1485
+ if ($this->config->getUserAgent()) {
1486
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1487
+ }
1488
+
1489
+ $headers = array_merge(
1490
+ $defaultHeaders,
1491
+ $headerParams,
1492
+ $headers
1493
+ );
1494
+
1495
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1496
+ return new Request(
1497
+ 'GET',
1498
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1499
+ $headers,
1500
+ $httpBody
1501
+ );
1502
+ }
1503
+
1504
+ /**
1505
+ * Operation updateFolder
1506
+ *
1507
+ * Update a contact folder
1508
+ *
1509
+ * @param int $folderId Id of the folder (required)
1510
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required)
1511
+ *
1512
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1513
+ * @throws \InvalidArgumentException
1514
+ * @return void
1515
+ */
1516
+ public function updateFolder($folderId, $updateFolder)
1517
+ {
1518
+ $this->updateFolderWithHttpInfo($folderId, $updateFolder);
1519
+ }
1520
+
1521
+ /**
1522
+ * Operation updateFolderWithHttpInfo
1523
+ *
1524
+ * Update a contact folder
1525
+ *
1526
+ * @param int $folderId Id of the folder (required)
1527
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required)
1528
+ *
1529
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1530
+ * @throws \InvalidArgumentException
1531
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
1532
+ */
1533
+ public function updateFolderWithHttpInfo($folderId, $updateFolder)
1534
+ {
1535
+ $returnType = '';
1536
+ $request = $this->updateFolderRequest($folderId, $updateFolder);
1537
+
1538
+ try {
1539
+ $options = $this->createHttpClientOption();
1540
+ try {
1541
+ $response = $this->client->send($request, $options);
1542
+ } catch (RequestException $e) {
1543
+ throw new ApiException(
1544
+ "[{$e->getCode()}] {$e->getMessage()}",
1545
+ $e->getCode(),
1546
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1547
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1548
+ );
1549
+ }
1550
+
1551
+ $statusCode = $response->getStatusCode();
1552
+
1553
+ if ($statusCode < 200 || $statusCode > 299) {
1554
+ throw new ApiException(
1555
+ sprintf(
1556
+ '[%d] Error connecting to the API (%s)',
1557
+ $statusCode,
1558
+ $request->getUri()
1559
+ ),
1560
+ $statusCode,
1561
+ $response->getHeaders(),
1562
+ $response->getBody()
1563
+ );
1564
+ }
1565
+
1566
+ return [null, $statusCode, $response->getHeaders()];
1567
+
1568
+ } catch (ApiException $e) {
1569
+ switch ($e->getCode()) {
1570
+ case 400:
1571
+ $data = ObjectSerializer::deserialize(
1572
+ $e->getResponseBody(),
1573
+ '\SendinBlue\Client\Model\ErrorModel',
1574
+ $e->getResponseHeaders()
1575
+ );
1576
+ $e->setResponseObject($data);
1577
+ break;
1578
+ case 404:
1579
+ $data = ObjectSerializer::deserialize(
1580
+ $e->getResponseBody(),
1581
+ '\SendinBlue\Client\Model\ErrorModel',
1582
+ $e->getResponseHeaders()
1583
+ );
1584
+ $e->setResponseObject($data);
1585
+ break;
1586
+ }
1587
+ throw $e;
1588
+ }
1589
+ }
1590
+
1591
+ /**
1592
+ * Operation updateFolderAsync
1593
+ *
1594
+ * Update a contact folder
1595
+ *
1596
+ * @param int $folderId Id of the folder (required)
1597
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required)
1598
+ *
1599
+ * @throws \InvalidArgumentException
1600
+ * @return \GuzzleHttp\Promise\PromiseInterface
1601
+ */
1602
+ public function updateFolderAsync($folderId, $updateFolder)
1603
+ {
1604
+ return $this->updateFolderAsyncWithHttpInfo($folderId, $updateFolder)
1605
+ ->then(
1606
+ function ($response) {
1607
+ return $response[0];
1608
+ }
1609
+ );
1610
+ }
1611
+
1612
+ /**
1613
+ * Operation updateFolderAsyncWithHttpInfo
1614
+ *
1615
+ * Update a contact folder
1616
+ *
1617
+ * @param int $folderId Id of the folder (required)
1618
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required)
1619
+ *
1620
+ * @throws \InvalidArgumentException
1621
+ * @return \GuzzleHttp\Promise\PromiseInterface
1622
+ */
1623
+ public function updateFolderAsyncWithHttpInfo($folderId, $updateFolder)
1624
+ {
1625
+ $returnType = '';
1626
+ $request = $this->updateFolderRequest($folderId, $updateFolder);
1627
+
1628
+ return $this->client
1629
+ ->sendAsync($request, $this->createHttpClientOption())
1630
+ ->then(
1631
+ function ($response) use ($returnType) {
1632
+ return [null, $response->getStatusCode(), $response->getHeaders()];
1633
+ },
1634
+ function ($exception) {
1635
+ $response = $exception->getResponse();
1636
+ $statusCode = $response->getStatusCode();
1637
+ throw new ApiException(
1638
+ sprintf(
1639
+ '[%d] Error connecting to the API (%s)',
1640
+ $statusCode,
1641
+ $exception->getRequest()->getUri()
1642
+ ),
1643
+ $statusCode,
1644
+ $response->getHeaders(),
1645
+ $response->getBody()
1646
+ );
1647
+ }
1648
+ );
1649
+ }
1650
+
1651
+ /**
1652
+ * Create request for operation 'updateFolder'
1653
+ *
1654
+ * @param int $folderId Id of the folder (required)
1655
+ * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required)
1656
+ *
1657
+ * @throws \InvalidArgumentException
1658
+ * @return \GuzzleHttp\Psr7\Request
1659
+ */
1660
+ protected function updateFolderRequest($folderId, $updateFolder)
1661
+ {
1662
+ // verify the required parameter 'folderId' is set
1663
+ if ($folderId === null) {
1664
+ throw new \InvalidArgumentException(
1665
+ 'Missing the required parameter $folderId when calling updateFolder'
1666
+ );
1667
+ }
1668
+ // verify the required parameter 'updateFolder' is set
1669
+ if ($updateFolder === null) {
1670
+ throw new \InvalidArgumentException(
1671
+ 'Missing the required parameter $updateFolder when calling updateFolder'
1672
+ );
1673
+ }
1674
+
1675
+ $resourcePath = '/contacts/folders/{folderId}';
1676
+ $formParams = [];
1677
+ $queryParams = [];
1678
+ $headerParams = [];
1679
+ $httpBody = '';
1680
+ $multipart = false;
1681
+
1682
+
1683
+ // path params
1684
+ if ($folderId !== null) {
1685
+ $resourcePath = str_replace(
1686
+ '{' . 'folderId' . '}',
1687
+ ObjectSerializer::toPathValue($folderId),
1688
+ $resourcePath
1689
+ );
1690
+ }
1691
+
1692
+ // body params
1693
+ $_tempBody = null;
1694
+ if (isset($updateFolder)) {
1695
+ $_tempBody = $updateFolder;
1696
+ }
1697
+
1698
+ if ($multipart) {
1699
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1700
+ ['application/json']
1701
+ );
1702
+ } else {
1703
+ $headers = $this->headerSelector->selectHeaders(
1704
+ ['application/json'],
1705
+ ['application/json']
1706
+ );
1707
+ }
1708
+
1709
+ // for model (json/xml)
1710
+ if (isset($_tempBody)) {
1711
+ // $_tempBody is the method argument, if present
1712
+ $httpBody = $_tempBody;
1713
+ // \stdClass has no __toString(), so we should encode it manually
1714
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1715
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1716
+ }
1717
+ } elseif (count($formParams) > 0) {
1718
+ if ($multipart) {
1719
+ $multipartContents = [];
1720
+ foreach ($formParams as $formParamName => $formParamValue) {
1721
+ $multipartContents[] = [
1722
+ 'name' => $formParamName,
1723
+ 'contents' => $formParamValue
1724
+ ];
1725
+ }
1726
+ // for HTTP post (form)
1727
+ $httpBody = new MultipartStream($multipartContents);
1728
+
1729
+ } elseif ($headers['Content-Type'] === 'application/json') {
1730
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1731
+
1732
+ } else {
1733
+ // for HTTP post (form)
1734
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1735
+ }
1736
+ }
1737
+
1738
+ // this endpoint requires API key authentication
1739
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1740
+ if ($apiKey !== null) {
1741
+ $headers['api-key'] = $apiKey;
1742
+ }
1743
+ // this endpoint requires API key authentication
1744
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1745
+ if ($apiKey !== null) {
1746
+ $headers['partner-key'] = $apiKey;
1747
+ }
1748
+
1749
+ $defaultHeaders = [];
1750
+ if ($this->config->getUserAgent()) {
1751
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1752
+ }
1753
+
1754
+ $headers = array_merge(
1755
+ $defaultHeaders,
1756
+ $headerParams,
1757
+ $headers
1758
+ );
1759
+
1760
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1761
+ return new Request(
1762
+ 'PUT',
1763
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1764
+ $headers,
1765
+ $httpBody
1766
+ );
1767
+ }
1768
+
1769
+ /**
1770
+ * Create http client option
1771
+ *
1772
+ * @throws \RuntimeException on file opening failure
1773
+ * @return array of http client options
1774
+ */
1775
+ protected function createHttpClientOption()
1776
+ {
1777
+ $options = [];
1778
+ if ($this->config->getDebug()) {
1779
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
1780
+ if (!$options[RequestOptions::DEBUG]) {
1781
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
1782
+ }
1783
+ }
1784
+
1785
+ return $options;
1786
+ }
1787
+ }
vendor/sendinblue/api-v3-sdk/lib/Api/ListsApi.php ADDED
@@ -0,0 +1,2698 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ListsApi
4
+ * PHP version 5
5
+ *
6
+ * @category Class
7
+ * @package SendinBlue\Client
8
+ * @author Swagger Codegen team
9
+ * @link https://github.com/swagger-api/swagger-codegen
10
+ */
11
+
12
+ /**
13
+ * SendinBlue API
14
+ *
15
+ * SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
16
+ *
17
+ * OpenAPI spec version: 3.0.0
18
+ * Contact: contact@sendinblue.com
19
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
20
+ * Swagger Codegen version: 2.3.1
21
+ */
22
+
23
+ /**
24
+ * NOTE: This class is auto generated by the swagger code generator program.
25
+ * https://github.com/swagger-api/swagger-codegen
26
+ * Do not edit the class manually.
27
+ */
28
+
29
+ namespace SendinBlue\Client\Api;
30
+
31
+ use GuzzleHttp\Client;
32
+ use GuzzleHttp\ClientInterface;
33
+ use GuzzleHttp\Exception\RequestException;
34
+ use GuzzleHttp\Psr7\MultipartStream;
35
+ use GuzzleHttp\Psr7\Request;
36
+ use GuzzleHttp\RequestOptions;
37
+ use SendinBlue\Client\ApiException;
38
+ use SendinBlue\Client\Configuration;
39
+ use SendinBlue\Client\HeaderSelector;
40
+ use SendinBlue\Client\ObjectSerializer;
41
+
42
+ /**
43
+ * ListsApi Class Doc Comment
44
+ *
45
+ * @category Class
46
+ * @package SendinBlue\Client
47
+ * @author Swagger Codegen team
48
+ * @link https://github.com/swagger-api/swagger-codegen
49
+ */
50
+ class ListsApi
51
+ {
52
+ /**
53
+ * @var ClientInterface
54
+ */
55
+ protected $client;
56
+
57
+ /**
58
+ * @var Configuration
59
+ */
60
+ protected $config;
61
+
62
+ /**
63
+ * @param ClientInterface $client
64
+ * @param Configuration $config
65
+ * @param HeaderSelector $selector
66
+ */
67
+ public function __construct(
68
+ ClientInterface $client = null,
69
+ Configuration $config = null,
70
+ HeaderSelector $selector = null
71
+ ) {
72
+ $this->client = $client ?: new Client();
73
+ $this->config = $config ?: new Configuration();
74
+ $this->headerSelector = $selector ?: new HeaderSelector();
75
+ }
76
+
77
+ /**
78
+ * @return Configuration
79
+ */
80
+ public function getConfig()
81
+ {
82
+ return $this->config;
83
+ }
84
+
85
+ /**
86
+ * Operation addContactToList
87
+ *
88
+ * Add existing contacts to a list
89
+ *
90
+ * @param int $listId Id of the list (required)
91
+ * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required)
92
+ *
93
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
94
+ * @throws \InvalidArgumentException
95
+ * @return \SendinBlue\Client\Model\PostContactInfo
96
+ */
97
+ public function addContactToList($listId, $contactEmails)
98
+ {
99
+ list($response) = $this->addContactToListWithHttpInfo($listId, $contactEmails);
100
+ return $response;
101
+ }
102
+
103
+ /**
104
+ * Operation addContactToListWithHttpInfo
105
+ *
106
+ * Add existing contacts to a list
107
+ *
108
+ * @param int $listId Id of the list (required)
109
+ * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required)
110
+ *
111
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
112
+ * @throws \InvalidArgumentException
113
+ * @return array of \SendinBlue\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings)
114
+ */
115
+ public function addContactToListWithHttpInfo($listId, $contactEmails)
116
+ {
117
+ $returnType = '\SendinBlue\Client\Model\PostContactInfo';
118
+ $request = $this->addContactToListRequest($listId, $contactEmails);
119
+
120
+ try {
121
+ $options = $this->createHttpClientOption();
122
+ try {
123
+ $response = $this->client->send($request, $options);
124
+ } catch (RequestException $e) {
125
+ throw new ApiException(
126
+ "[{$e->getCode()}] {$e->getMessage()}",
127
+ $e->getCode(),
128
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
129
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
130
+ );
131
+ }
132
+
133
+ $statusCode = $response->getStatusCode();
134
+
135
+ if ($statusCode < 200 || $statusCode > 299) {
136
+ throw new ApiException(
137
+ sprintf(
138
+ '[%d] Error connecting to the API (%s)',
139
+ $statusCode,
140
+ $request->getUri()
141
+ ),
142
+ $statusCode,
143
+ $response->getHeaders(),
144
+ $response->getBody()
145
+ );
146
+ }
147
+
148
+ $responseBody = $response->getBody();
149
+ if ($returnType === '\SplFileObject') {
150
+ $content = $responseBody; //stream goes to serializer
151
+ } else {
152
+ $content = $responseBody->getContents();
153
+ if ($returnType !== 'string') {
154
+ $content = json_decode($content);
155
+ }
156
+ }
157
+
158
+ return [
159
+ ObjectSerializer::deserialize($content, $returnType, []),
160
+ $response->getStatusCode(),
161
+ $response->getHeaders()
162
+ ];
163
+
164
+ } catch (ApiException $e) {
165
+ switch ($e->getCode()) {
166
+ case 201:
167
+ $data = ObjectSerializer::deserialize(
168
+ $e->getResponseBody(),
169
+ '\SendinBlue\Client\Model\PostContactInfo',
170
+ $e->getResponseHeaders()
171
+ );
172
+ $e->setResponseObject($data);
173
+ break;
174
+ case 400:
175
+ $data = ObjectSerializer::deserialize(
176
+ $e->getResponseBody(),
177
+ '\SendinBlue\Client\Model\ErrorModel',
178
+ $e->getResponseHeaders()
179
+ );
180
+ $e->setResponseObject($data);
181
+ break;
182
+ case 404:
183
+ $data = ObjectSerializer::deserialize(
184
+ $e->getResponseBody(),
185
+ '\SendinBlue\Client\Model\ErrorModel',
186
+ $e->getResponseHeaders()
187
+ );
188
+ $e->setResponseObject($data);
189
+ break;
190
+ }
191
+ throw $e;
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Operation addContactToListAsync
197
+ *
198
+ * Add existing contacts to a list
199
+ *
200
+ * @param int $listId Id of the list (required)
201
+ * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required)
202
+ *
203
+ * @throws \InvalidArgumentException
204
+ * @return \GuzzleHttp\Promise\PromiseInterface
205
+ */
206
+ public function addContactToListAsync($listId, $contactEmails)
207
+ {
208
+ return $this->addContactToListAsyncWithHttpInfo($listId, $contactEmails)
209
+ ->then(
210
+ function ($response) {
211
+ return $response[0];
212
+ }
213
+ );
214
+ }
215
+
216
+ /**
217
+ * Operation addContactToListAsyncWithHttpInfo
218
+ *
219
+ * Add existing contacts to a list
220
+ *
221
+ * @param int $listId Id of the list (required)
222
+ * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required)
223
+ *
224
+ * @throws \InvalidArgumentException
225
+ * @return \GuzzleHttp\Promise\PromiseInterface
226
+ */
227
+ public function addContactToListAsyncWithHttpInfo($listId, $contactEmails)
228
+ {
229
+ $returnType = '\SendinBlue\Client\Model\PostContactInfo';
230
+ $request = $this->addContactToListRequest($listId, $contactEmails);
231
+
232
+ return $this->client
233
+ ->sendAsync($request, $this->createHttpClientOption())
234
+ ->then(
235
+ function ($response) use ($returnType) {
236
+ $responseBody = $response->getBody();
237
+ if ($returnType === '\SplFileObject') {
238
+ $content = $responseBody; //stream goes to serializer
239
+ } else {
240
+ $content = $responseBody->getContents();
241
+ if ($returnType !== 'string') {
242
+ $content = json_decode($content);
243
+ }
244
+ }
245
+
246
+ return [
247
+ ObjectSerializer::deserialize($content, $returnType, []),
248
+ $response->getStatusCode(),
249
+ $response->getHeaders()
250
+ ];
251
+ },
252
+ function ($exception) {
253
+ $response = $exception->getResponse();
254
+ $statusCode = $response->getStatusCode();
255
+ throw new ApiException(
256
+ sprintf(
257
+ '[%d] Error connecting to the API (%s)',
258
+ $statusCode,
259
+ $exception->getRequest()->getUri()
260
+ ),
261
+ $statusCode,
262
+ $response->getHeaders(),
263
+ $response->getBody()
264
+ );
265
+ }
266
+ );
267
+ }
268
+
269
+ /**
270
+ * Create request for operation 'addContactToList'
271
+ *
272
+ * @param int $listId Id of the list (required)
273
+ * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required)
274
+ *
275
+ * @throws \InvalidArgumentException
276
+ * @return \GuzzleHttp\Psr7\Request
277
+ */
278
+ protected function addContactToListRequest($listId, $contactEmails)
279
+ {
280
+ // verify the required parameter 'listId' is set
281
+ if ($listId === null) {
282
+ throw new \InvalidArgumentException(
283
+ 'Missing the required parameter $listId when calling addContactToList'
284
+ );
285
+ }
286
+ // verify the required parameter 'contactEmails' is set
287
+ if ($contactEmails === null) {
288
+ throw new \InvalidArgumentException(
289
+ 'Missing the required parameter $contactEmails when calling addContactToList'
290
+ );
291
+ }
292
+
293
+ $resourcePath = '/contacts/lists/{listId}/contacts/add';
294
+ $formParams = [];
295
+ $queryParams = [];
296
+ $headerParams = [];
297
+ $httpBody = '';
298
+ $multipart = false;
299
+
300
+
301
+ // path params
302
+ if ($listId !== null) {
303
+ $resourcePath = str_replace(
304
+ '{' . 'listId' . '}',
305
+ ObjectSerializer::toPathValue($listId),
306
+ $resourcePath
307
+ );
308
+ }
309
+
310
+ // body params
311
+ $_tempBody = null;
312
+ if (isset($contactEmails)) {
313
+ $_tempBody = $contactEmails;
314
+ }
315
+
316
+ if ($multipart) {
317
+ $headers = $this->headerSelector->selectHeadersForMultipart(
318
+ ['application/json']
319
+ );
320
+ } else {
321
+ $headers = $this->headerSelector->selectHeaders(
322
+ ['application/json'],
323
+ ['application/json']
324
+ );
325
+ }
326
+
327
+ // for model (json/xml)
328
+ if (isset($_tempBody)) {
329
+ // $_tempBody is the method argument, if present
330
+ $httpBody = $_tempBody;
331
+ // \stdClass has no __toString(), so we should encode it manually
332
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
333
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
334
+ }
335
+ } elseif (count($formParams) > 0) {
336
+ if ($multipart) {
337
+ $multipartContents = [];
338
+ foreach ($formParams as $formParamName => $formParamValue) {
339
+ $multipartContents[] = [
340
+ 'name' => $formParamName,
341
+ 'contents' => $formParamValue
342
+ ];
343
+ }
344
+ // for HTTP post (form)
345
+ $httpBody = new MultipartStream($multipartContents);
346
+
347
+ } elseif ($headers['Content-Type'] === 'application/json') {
348
+ $httpBody = \GuzzleHttp\json_encode($formParams);
349
+
350
+ } else {
351
+ // for HTTP post (form)
352
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
353
+ }
354
+ }
355
+
356
+ // this endpoint requires API key authentication
357
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
358
+ if ($apiKey !== null) {
359
+ $headers['api-key'] = $apiKey;
360
+ }
361
+ // this endpoint requires API key authentication
362
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
363
+ if ($apiKey !== null) {
364
+ $headers['partner-key'] = $apiKey;
365
+ }
366
+
367
+ $defaultHeaders = [];
368
+ if ($this->config->getUserAgent()) {
369
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
370
+ }
371
+
372
+ $headers = array_merge(
373
+ $defaultHeaders,
374
+ $headerParams,
375
+ $headers
376
+ );
377
+
378
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
379
+ return new Request(
380
+ 'POST',
381
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
382
+ $headers,
383
+ $httpBody
384
+ );
385
+ }
386
+
387
+ /**
388
+ * Operation createList
389
+ *
390
+ * Create a list
391
+ *
392
+ * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required)
393
+ *
394
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
395
+ * @throws \InvalidArgumentException
396
+ * @return \SendinBlue\Client\Model\CreateModel
397
+ */
398
+ public function createList($createList)
399
+ {
400
+ list($response) = $this->createListWithHttpInfo($createList);
401
+ return $response;
402
+ }
403
+
404
+ /**
405
+ * Operation createListWithHttpInfo
406
+ *
407
+ * Create a list
408
+ *
409
+ * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required)
410
+ *
411
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
412
+ * @throws \InvalidArgumentException
413
+ * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings)
414
+ */
415
+ public function createListWithHttpInfo($createList)
416
+ {
417
+ $returnType = '\SendinBlue\Client\Model\CreateModel';
418
+ $request = $this->createListRequest($createList);
419
+
420
+ try {
421
+ $options = $this->createHttpClientOption();
422
+ try {
423
+ $response = $this->client->send($request, $options);
424
+ } catch (RequestException $e) {
425
+ throw new ApiException(
426
+ "[{$e->getCode()}] {$e->getMessage()}",
427
+ $e->getCode(),
428
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
429
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
430
+ );
431
+ }
432
+
433
+ $statusCode = $response->getStatusCode();
434
+
435
+ if ($statusCode < 200 || $statusCode > 299) {
436
+ throw new ApiException(
437
+ sprintf(
438
+ '[%d] Error connecting to the API (%s)',
439
+ $statusCode,
440
+ $request->getUri()
441
+ ),
442
+ $statusCode,
443
+ $response->getHeaders(),
444
+ $response->getBody()
445
+ );
446
+ }
447
+
448
+ $responseBody = $response->getBody();
449
+ if ($returnType === '\SplFileObject') {
450
+ $content = $responseBody; //stream goes to serializer
451
+ } else {
452
+ $content = $responseBody->getContents();
453
+ if ($returnType !== 'string') {
454
+ $content = json_decode($content);
455
+ }
456
+ }
457
+
458
+ return [
459
+ ObjectSerializer::deserialize($content, $returnType, []),
460
+ $response->getStatusCode(),
461
+ $response->getHeaders()
462
+ ];
463
+
464
+ } catch (ApiException $e) {
465
+ switch ($e->getCode()) {
466
+ case 201:
467
+ $data = ObjectSerializer::deserialize(
468
+ $e->getResponseBody(),
469
+ '\SendinBlue\Client\Model\CreateModel',
470
+ $e->getResponseHeaders()
471
+ );
472
+ $e->setResponseObject($data);
473
+ break;
474
+ case 400:
475
+ $data = ObjectSerializer::deserialize(
476
+ $e->getResponseBody(),
477
+ '\SendinBlue\Client\Model\ErrorModel',
478
+ $e->getResponseHeaders()
479
+ );
480
+ $e->setResponseObject($data);
481
+ break;
482
+ }
483
+ throw $e;
484
+ }
485
+ }
486
+
487
+ /**
488
+ * Operation createListAsync
489
+ *
490
+ * Create a list
491
+ *
492
+ * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required)
493
+ *
494
+ * @throws \InvalidArgumentException
495
+ * @return \GuzzleHttp\Promise\PromiseInterface
496
+ */
497
+ public function createListAsync($createList)
498
+ {
499
+ return $this->createListAsyncWithHttpInfo($createList)
500
+ ->then(
501
+ function ($response) {
502
+ return $response[0];
503
+ }
504
+ );
505
+ }
506
+
507
+ /**
508
+ * Operation createListAsyncWithHttpInfo
509
+ *
510
+ * Create a list
511
+ *
512
+ * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required)
513
+ *
514
+ * @throws \InvalidArgumentException
515
+ * @return \GuzzleHttp\Promise\PromiseInterface
516
+ */
517
+ public function createListAsyncWithHttpInfo($createList)
518
+ {
519
+ $returnType = '\SendinBlue\Client\Model\CreateModel';
520
+ $request = $this->createListRequest($createList);
521
+
522
+ return $this->client
523
+ ->sendAsync($request, $this->createHttpClientOption())
524
+ ->then(
525
+ function ($response) use ($returnType) {
526
+ $responseBody = $response->getBody();
527
+ if ($returnType === '\SplFileObject') {
528
+ $content = $responseBody; //stream goes to serializer
529
+ } else {
530
+ $content = $responseBody->getContents();
531
+ if ($returnType !== 'string') {
532
+ $content = json_decode($content);
533
+ }
534
+ }
535
+
536
+ return [
537
+ ObjectSerializer::deserialize($content, $returnType, []),
538
+ $response->getStatusCode(),
539
+ $response->getHeaders()
540
+ ];
541
+ },
542
+ function ($exception) {
543
+ $response = $exception->getResponse();
544
+ $statusCode = $response->getStatusCode();
545
+ throw new ApiException(
546
+ sprintf(
547
+ '[%d] Error connecting to the API (%s)',
548
+ $statusCode,
549
+ $exception->getRequest()->getUri()
550
+ ),
551
+ $statusCode,
552
+ $response->getHeaders(),
553
+ $response->getBody()
554
+ );
555
+ }
556
+ );
557
+ }
558
+
559
+ /**
560
+ * Create request for operation 'createList'
561
+ *
562
+ * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required)
563
+ *
564
+ * @throws \InvalidArgumentException
565
+ * @return \GuzzleHttp\Psr7\Request
566
+ */
567
+ protected function createListRequest($createList)
568
+ {
569
+ // verify the required parameter 'createList' is set
570
+ if ($createList === null) {
571
+ throw new \InvalidArgumentException(
572
+ 'Missing the required parameter $createList when calling createList'
573
+ );
574
+ }
575
+
576
+ $resourcePath = '/contacts/lists';
577
+ $formParams = [];
578
+ $queryParams = [];
579
+ $headerParams = [];
580
+ $httpBody = '';
581
+ $multipart = false;
582
+
583
+
584
+
585
+ // body params
586
+ $_tempBody = null;
587
+ if (isset($createList)) {
588
+ $_tempBody = $createList;
589
+ }
590
+
591
+ if ($multipart) {
592
+ $headers = $this->headerSelector->selectHeadersForMultipart(
593
+ ['application/json']
594
+ );
595
+ } else {
596
+ $headers = $this->headerSelector->selectHeaders(
597
+ ['application/json'],
598
+ ['application/json']
599
+ );
600
+ }
601
+
602
+ // for model (json/xml)
603
+ if (isset($_tempBody)) {
604
+ // $_tempBody is the method argument, if present
605
+ $httpBody = $_tempBody;
606
+ // \stdClass has no __toString(), so we should encode it manually
607
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
608
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
609
+ }
610
+ } elseif (count($formParams) > 0) {
611
+ if ($multipart) {
612
+ $multipartContents = [];
613
+ foreach ($formParams as $formParamName => $formParamValue) {
614
+ $multipartContents[] = [
615
+ 'name' => $formParamName,
616
+ 'contents' => $formParamValue
617
+ ];
618
+ }
619
+ // for HTTP post (form)
620
+ $httpBody = new MultipartStream($multipartContents);
621
+
622
+ } elseif ($headers['Content-Type'] === 'application/json') {
623
+ $httpBody = \GuzzleHttp\json_encode($formParams);
624
+
625
+ } else {
626
+ // for HTTP post (form)
627
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
628
+ }
629
+ }
630
+
631
+ // this endpoint requires API key authentication
632
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
633
+ if ($apiKey !== null) {
634
+ $headers['api-key'] = $apiKey;
635
+ }
636
+ // this endpoint requires API key authentication
637
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
638
+ if ($apiKey !== null) {
639
+ $headers['partner-key'] = $apiKey;
640
+ }
641
+
642
+ $defaultHeaders = [];
643
+ if ($this->config->getUserAgent()) {
644
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
645
+ }
646
+
647
+ $headers = array_merge(
648
+ $defaultHeaders,
649
+ $headerParams,
650
+ $headers
651
+ );
652
+
653
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
654
+ return new Request(
655
+ 'POST',
656
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
657
+ $headers,
658
+ $httpBody
659
+ );
660
+ }
661
+
662
+ /**
663
+ * Operation deleteList
664
+ *
665
+ * Delete a list
666
+ *
667
+ * @param int $listId Id of the list (required)
668
+ *
669
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
670
+ * @throws \InvalidArgumentException
671
+ * @return void
672
+ */
673
+ public function deleteList($listId)
674
+ {
675
+ $this->deleteListWithHttpInfo($listId);
676
+ }
677
+
678
+ /**
679
+ * Operation deleteListWithHttpInfo
680
+ *
681
+ * Delete a list
682
+ *
683
+ * @param int $listId Id of the list (required)
684
+ *
685
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
686
+ * @throws \InvalidArgumentException
687
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
688
+ */
689
+ public function deleteListWithHttpInfo($listId)
690
+ {
691
+ $returnType = '';
692
+ $request = $this->deleteListRequest($listId);
693
+
694
+ try {
695
+ $options = $this->createHttpClientOption();
696
+ try {
697
+ $response = $this->client->send($request, $options);
698
+ } catch (RequestException $e) {
699
+ throw new ApiException(
700
+ "[{$e->getCode()}] {$e->getMessage()}",
701
+ $e->getCode(),
702
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
703
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
704
+ );
705
+ }
706
+
707
+ $statusCode = $response->getStatusCode();
708
+
709
+ if ($statusCode < 200 || $statusCode > 299) {
710
+ throw new ApiException(
711
+ sprintf(
712
+ '[%d] Error connecting to the API (%s)',
713
+ $statusCode,
714
+ $request->getUri()
715
+ ),
716
+ $statusCode,
717
+ $response->getHeaders(),
718
+ $response->getBody()
719
+ );
720
+ }
721
+
722
+ return [null, $statusCode, $response->getHeaders()];
723
+
724
+ } catch (ApiException $e) {
725
+ switch ($e->getCode()) {
726
+ case 400:
727
+ $data = ObjectSerializer::deserialize(
728
+ $e->getResponseBody(),
729
+ '\SendinBlue\Client\Model\ErrorModel',
730
+ $e->getResponseHeaders()
731
+ );
732
+ $e->setResponseObject($data);
733
+ break;
734
+ case 404:
735
+ $data = ObjectSerializer::deserialize(
736
+ $e->getResponseBody(),
737
+ '\SendinBlue\Client\Model\ErrorModel',
738
+ $e->getResponseHeaders()
739
+ );
740
+ $e->setResponseObject($data);
741
+ break;
742
+ }
743
+ throw $e;
744
+ }
745
+ }
746
+
747
+ /**
748
+ * Operation deleteListAsync
749
+ *
750
+ * Delete a list
751
+ *
752
+ * @param int $listId Id of the list (required)
753
+ *
754
+ * @throws \InvalidArgumentException
755
+ * @return \GuzzleHttp\Promise\PromiseInterface
756
+ */
757
+ public function deleteListAsync($listId)
758
+ {
759
+ return $this->deleteListAsyncWithHttpInfo($listId)
760
+ ->then(
761
+ function ($response) {
762
+ return $response[0];
763
+ }
764
+ );
765
+ }
766
+
767
+ /**
768
+ * Operation deleteListAsyncWithHttpInfo
769
+ *
770
+ * Delete a list
771
+ *
772
+ * @param int $listId Id of the list (required)
773
+ *
774
+ * @throws \InvalidArgumentException
775
+ * @return \GuzzleHttp\Promise\PromiseInterface
776
+ */
777
+ public function deleteListAsyncWithHttpInfo($listId)
778
+ {
779
+ $returnType = '';
780
+ $request = $this->deleteListRequest($listId);
781
+
782
+ return $this->client
783
+ ->sendAsync($request, $this->createHttpClientOption())
784
+ ->then(
785
+ function ($response) use ($returnType) {
786
+ return [null, $response->getStatusCode(), $response->getHeaders()];
787
+ },
788
+ function ($exception) {
789
+ $response = $exception->getResponse();
790
+ $statusCode = $response->getStatusCode();
791
+ throw new ApiException(
792
+ sprintf(
793
+ '[%d] Error connecting to the API (%s)',
794
+ $statusCode,
795
+ $exception->getRequest()->getUri()
796
+ ),
797
+ $statusCode,
798
+ $response->getHeaders(),
799
+ $response->getBody()
800
+ );
801
+ }
802
+ );
803
+ }
804
+
805
+ /**
806
+ * Create request for operation 'deleteList'
807
+ *
808
+ * @param int $listId Id of the list (required)
809
+ *
810
+ * @throws \InvalidArgumentException
811
+ * @return \GuzzleHttp\Psr7\Request
812
+ */
813
+ protected function deleteListRequest($listId)
814
+ {
815
+ // verify the required parameter 'listId' is set
816
+ if ($listId === null) {
817
+ throw new \InvalidArgumentException(
818
+ 'Missing the required parameter $listId when calling deleteList'
819
+ );
820
+ }
821
+
822
+ $resourcePath = '/contacts/lists/{listId}';
823
+ $formParams = [];
824
+ $queryParams = [];
825
+ $headerParams = [];
826
+ $httpBody = '';
827
+ $multipart = false;
828
+
829
+
830
+ // path params
831
+ if ($listId !== null) {
832
+ $resourcePath = str_replace(
833
+ '{' . 'listId' . '}',
834
+ ObjectSerializer::toPathValue($listId),
835
+ $resourcePath
836
+ );
837
+ }
838
+
839
+ // body params
840
+ $_tempBody = null;
841
+
842
+ if ($multipart) {
843
+ $headers = $this->headerSelector->selectHeadersForMultipart(
844
+ ['application/json']
845
+ );
846
+ } else {
847
+ $headers = $this->headerSelector->selectHeaders(
848
+ ['application/json'],
849
+ ['application/json']
850
+ );
851
+ }
852
+
853
+ // for model (json/xml)
854
+ if (isset($_tempBody)) {
855
+ // $_tempBody is the method argument, if present
856
+ $httpBody = $_tempBody;
857
+ // \stdClass has no __toString(), so we should encode it manually
858
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
859
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
860
+ }
861
+ } elseif (count($formParams) > 0) {
862
+ if ($multipart) {
863
+ $multipartContents = [];
864
+ foreach ($formParams as $formParamName => $formParamValue) {
865
+ $multipartContents[] = [
866
+ 'name' => $formParamName,
867
+ 'contents' => $formParamValue
868
+ ];
869
+ }
870
+ // for HTTP post (form)
871
+ $httpBody = new MultipartStream($multipartContents);
872
+
873
+ } elseif ($headers['Content-Type'] === 'application/json') {
874
+ $httpBody = \GuzzleHttp\json_encode($formParams);
875
+
876
+ } else {
877
+ // for HTTP post (form)
878
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
879
+ }
880
+ }
881
+
882
+ // this endpoint requires API key authentication
883
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
884
+ if ($apiKey !== null) {
885
+ $headers['api-key'] = $apiKey;
886
+ }
887
+ // this endpoint requires API key authentication
888
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
889
+ if ($apiKey !== null) {
890
+ $headers['partner-key'] = $apiKey;
891
+ }
892
+
893
+ $defaultHeaders = [];
894
+ if ($this->config->getUserAgent()) {
895
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
896
+ }
897
+
898
+ $headers = array_merge(
899
+ $defaultHeaders,
900
+ $headerParams,
901
+ $headers
902
+ );
903
+
904
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
905
+ return new Request(
906
+ 'DELETE',
907
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
908
+ $headers,
909
+ $httpBody
910
+ );
911
+ }
912
+
913
+ /**
914
+ * Operation getContactsFromList
915
+ *
916
+ * Get the contacts in a list
917
+ *
918
+ * @param int $listId Id of the list (required)
919
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
920
+ * @param int $limit Number of documents per page (optional, default to 50)
921
+ * @param int $offset Index of the first document of the page (optional, default to 0)
922
+ *
923
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
924
+ * @throws \InvalidArgumentException
925
+ * @return \SendinBlue\Client\Model\GetContacts
926
+ */
927
+ public function getContactsFromList($listId, $modifiedSince = null, $limit = '50', $offset = '0')
928
+ {
929
+ list($response) = $this->getContactsFromListWithHttpInfo($listId, $modifiedSince, $limit, $offset);
930
+ return $response;
931
+ }
932
+
933
+ /**
934
+ * Operation getContactsFromListWithHttpInfo
935
+ *
936
+ * Get the contacts in a list
937
+ *
938
+ * @param int $listId Id of the list (required)
939
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
940
+ * @param int $limit Number of documents per page (optional, default to 50)
941
+ * @param int $offset Index of the first document of the page (optional, default to 0)
942
+ *
943
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
944
+ * @throws \InvalidArgumentException
945
+ * @return array of \SendinBlue\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings)
946
+ */
947
+ public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0')
948
+ {
949
+ $returnType = '\SendinBlue\Client\Model\GetContacts';
950
+ $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset);
951
+
952
+ try {
953
+ $options = $this->createHttpClientOption();
954
+ try {
955
+ $response = $this->client->send($request, $options);
956
+ } catch (RequestException $e) {
957
+ throw new ApiException(
958
+ "[{$e->getCode()}] {$e->getMessage()}",
959
+ $e->getCode(),
960
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
961
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
962
+ );
963
+ }
964
+
965
+ $statusCode = $response->getStatusCode();
966
+
967
+ if ($statusCode < 200 || $statusCode > 299) {
968
+ throw new ApiException(
969
+ sprintf(
970
+ '[%d] Error connecting to the API (%s)',
971
+ $statusCode,
972
+ $request->getUri()
973
+ ),
974
+ $statusCode,
975
+ $response->getHeaders(),
976
+ $response->getBody()
977
+ );
978
+ }
979
+
980
+ $responseBody = $response->getBody();
981
+ if ($returnType === '\SplFileObject') {
982
+ $content = $responseBody; //stream goes to serializer
983
+ } else {
984
+ $content = $responseBody->getContents();
985
+ if ($returnType !== 'string') {
986
+ $content = json_decode($content);
987
+ }
988
+ }
989
+
990
+ return [
991
+ ObjectSerializer::deserialize($content, $returnType, []),
992
+ $response->getStatusCode(),
993
+ $response->getHeaders()
994
+ ];
995
+
996
+ } catch (ApiException $e) {
997
+ switch ($e->getCode()) {
998
+ case 200:
999
+ $data = ObjectSerializer::deserialize(
1000
+ $e->getResponseBody(),
1001
+ '\SendinBlue\Client\Model\GetContacts',
1002
+ $e->getResponseHeaders()
1003
+ );
1004
+ $e->setResponseObject($data);
1005
+ break;
1006
+ case 400:
1007
+ $data = ObjectSerializer::deserialize(
1008
+ $e->getResponseBody(),
1009
+ '\SendinBlue\Client\Model\ErrorModel',
1010
+ $e->getResponseHeaders()
1011
+ );
1012
+ $e->setResponseObject($data);
1013
+ break;
1014
+ case 404:
1015
+ $data = ObjectSerializer::deserialize(
1016
+ $e->getResponseBody(),
1017
+ '\SendinBlue\Client\Model\ErrorModel',
1018
+ $e->getResponseHeaders()
1019
+ );
1020
+ $e->setResponseObject($data);
1021
+ break;
1022
+ }
1023
+ throw $e;
1024
+ }
1025
+ }
1026
+
1027
+ /**
1028
+ * Operation getContactsFromListAsync
1029
+ *
1030
+ * Get the contacts in a list
1031
+ *
1032
+ * @param int $listId Id of the list (required)
1033
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
1034
+ * @param int $limit Number of documents per page (optional, default to 50)
1035
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1036
+ *
1037
+ * @throws \InvalidArgumentException
1038
+ * @return \GuzzleHttp\Promise\PromiseInterface
1039
+ */
1040
+ public function getContactsFromListAsync($listId, $modifiedSince = null, $limit = '50', $offset = '0')
1041
+ {
1042
+ return $this->getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince, $limit, $offset)
1043
+ ->then(
1044
+ function ($response) {
1045
+ return $response[0];
1046
+ }
1047
+ );
1048
+ }
1049
+
1050
+ /**
1051
+ * Operation getContactsFromListAsyncWithHttpInfo
1052
+ *
1053
+ * Get the contacts in a list
1054
+ *
1055
+ * @param int $listId Id of the list (required)
1056
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
1057
+ * @param int $limit Number of documents per page (optional, default to 50)
1058
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1059
+ *
1060
+ * @throws \InvalidArgumentException
1061
+ * @return \GuzzleHttp\Promise\PromiseInterface
1062
+ */
1063
+ public function getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0')
1064
+ {
1065
+ $returnType = '\SendinBlue\Client\Model\GetContacts';
1066
+ $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset);
1067
+
1068
+ return $this->client
1069
+ ->sendAsync($request, $this->createHttpClientOption())
1070
+ ->then(
1071
+ function ($response) use ($returnType) {
1072
+ $responseBody = $response->getBody();
1073
+ if ($returnType === '\SplFileObject') {
1074
+ $content = $responseBody; //stream goes to serializer
1075
+ } else {
1076
+ $content = $responseBody->getContents();
1077
+ if ($returnType !== 'string') {
1078
+ $content = json_decode($content);
1079
+ }
1080
+ }
1081
+
1082
+ return [
1083
+ ObjectSerializer::deserialize($content, $returnType, []),
1084
+ $response->getStatusCode(),
1085
+ $response->getHeaders()
1086
+ ];
1087
+ },
1088
+ function ($exception) {
1089
+ $response = $exception->getResponse();
1090
+ $statusCode = $response->getStatusCode();
1091
+ throw new ApiException(
1092
+ sprintf(
1093
+ '[%d] Error connecting to the API (%s)',
1094
+ $statusCode,
1095
+ $exception->getRequest()->getUri()
1096
+ ),
1097
+ $statusCode,
1098
+ $response->getHeaders(),
1099
+ $response->getBody()
1100
+ );
1101
+ }
1102
+ );
1103
+ }
1104
+
1105
+ /**
1106
+ * Create request for operation 'getContactsFromList'
1107
+ *
1108
+ * @param int $listId Id of the list (required)
1109
+ * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional)
1110
+ * @param int $limit Number of documents per page (optional, default to 50)
1111
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1112
+ *
1113
+ * @throws \InvalidArgumentException
1114
+ * @return \GuzzleHttp\Psr7\Request
1115
+ */
1116
+ protected function getContactsFromListRequest($listId, $modifiedSince = null, $limit = '50', $offset = '0')
1117
+ {
1118
+ // verify the required parameter 'listId' is set
1119
+ if ($listId === null) {
1120
+ throw new \InvalidArgumentException(
1121
+ 'Missing the required parameter $listId when calling getContactsFromList'
1122
+ );
1123
+ }
1124
+ if ($limit !== null && $limit > 500) {
1125
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling ListsApi.getContactsFromList, must be smaller than or equal to 500.');
1126
+ }
1127
+
1128
+
1129
+ $resourcePath = '/contacts/lists/{listId}/contacts';
1130
+ $formParams = [];
1131
+ $queryParams = [];
1132
+ $headerParams = [];
1133
+ $httpBody = '';
1134
+ $multipart = false;
1135
+
1136
+ // query params
1137
+ if ($modifiedSince !== null) {
1138
+ $queryParams['modifiedSince'] = ObjectSerializer::toQueryValue($modifiedSince);
1139
+ }
1140
+ // query params
1141
+ if ($limit !== null) {
1142
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
1143
+ }
1144
+ // query params
1145
+ if ($offset !== null) {
1146
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
1147
+ }
1148
+
1149
+ // path params
1150
+ if ($listId !== null) {
1151
+ $resourcePath = str_replace(
1152
+ '{' . 'listId' . '}',
1153
+ ObjectSerializer::toPathValue($listId),
1154
+ $resourcePath
1155
+ );
1156
+ }
1157
+
1158
+ // body params
1159
+ $_tempBody = null;
1160
+
1161
+ if ($multipart) {
1162
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1163
+ ['application/json']
1164
+ );
1165
+ } else {
1166
+ $headers = $this->headerSelector->selectHeaders(
1167
+ ['application/json'],
1168
+ ['application/json']
1169
+ );
1170
+ }
1171
+
1172
+ // for model (json/xml)
1173
+ if (isset($_tempBody)) {
1174
+ // $_tempBody is the method argument, if present
1175
+ $httpBody = $_tempBody;
1176
+ // \stdClass has no __toString(), so we should encode it manually
1177
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1178
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1179
+ }
1180
+ } elseif (count($formParams) > 0) {
1181
+ if ($multipart) {
1182
+ $multipartContents = [];
1183
+ foreach ($formParams as $formParamName => $formParamValue) {
1184
+ $multipartContents[] = [
1185
+ 'name' => $formParamName,
1186
+ 'contents' => $formParamValue
1187
+ ];
1188
+ }
1189
+ // for HTTP post (form)
1190
+ $httpBody = new MultipartStream($multipartContents);
1191
+
1192
+ } elseif ($headers['Content-Type'] === 'application/json') {
1193
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1194
+
1195
+ } else {
1196
+ // for HTTP post (form)
1197
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1198
+ }
1199
+ }
1200
+
1201
+ // this endpoint requires API key authentication
1202
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1203
+ if ($apiKey !== null) {
1204
+ $headers['api-key'] = $apiKey;
1205
+ }
1206
+ // this endpoint requires API key authentication
1207
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1208
+ if ($apiKey !== null) {
1209
+ $headers['partner-key'] = $apiKey;
1210
+ }
1211
+
1212
+ $defaultHeaders = [];
1213
+ if ($this->config->getUserAgent()) {
1214
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1215
+ }
1216
+
1217
+ $headers = array_merge(
1218
+ $defaultHeaders,
1219
+ $headerParams,
1220
+ $headers
1221
+ );
1222
+
1223
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1224
+ return new Request(
1225
+ 'GET',
1226
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1227
+ $headers,
1228
+ $httpBody
1229
+ );
1230
+ }
1231
+
1232
+ /**
1233
+ * Operation getFolderLists
1234
+ *
1235
+ * Get the lists in a folder
1236
+ *
1237
+ * @param int $folderId Id of the folder (required)
1238
+ * @param int $limit Number of documents per page (optional, default to 10)
1239
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1240
+ *
1241
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1242
+ * @throws \InvalidArgumentException
1243
+ * @return \SendinBlue\Client\Model\GetFolderLists
1244
+ */
1245
+ public function getFolderLists($folderId, $limit = '10', $offset = '0')
1246
+ {
1247
+ list($response) = $this->getFolderListsWithHttpInfo($folderId, $limit, $offset);
1248
+ return $response;
1249
+ }
1250
+
1251
+ /**
1252
+ * Operation getFolderListsWithHttpInfo
1253
+ *
1254
+ * Get the lists in a folder
1255
+ *
1256
+ * @param int $folderId Id of the folder (required)
1257
+ * @param int $limit Number of documents per page (optional, default to 10)
1258
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1259
+ *
1260
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1261
+ * @throws \InvalidArgumentException
1262
+ * @return array of \SendinBlue\Client\Model\GetFolderLists, HTTP status code, HTTP response headers (array of strings)
1263
+ */
1264
+ public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = '0')
1265
+ {
1266
+ $returnType = '\SendinBlue\Client\Model\GetFolderLists';
1267
+ $request = $this->getFolderListsRequest($folderId, $limit, $offset);
1268
+
1269
+ try {
1270
+ $options = $this->createHttpClientOption();
1271
+ try {
1272
+ $response = $this->client->send($request, $options);
1273
+ } catch (RequestException $e) {
1274
+ throw new ApiException(
1275
+ "[{$e->getCode()}] {$e->getMessage()}",
1276
+ $e->getCode(),
1277
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1278
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1279
+ );
1280
+ }
1281
+
1282
+ $statusCode = $response->getStatusCode();
1283
+
1284
+ if ($statusCode < 200 || $statusCode > 299) {
1285
+ throw new ApiException(
1286
+ sprintf(
1287
+ '[%d] Error connecting to the API (%s)',
1288
+ $statusCode,
1289
+ $request->getUri()
1290
+ ),
1291
+ $statusCode,
1292
+ $response->getHeaders(),
1293
+ $response->getBody()
1294
+ );
1295
+ }
1296
+
1297
+ $responseBody = $response->getBody();
1298
+ if ($returnType === '\SplFileObject') {
1299
+ $content = $responseBody; //stream goes to serializer
1300
+ } else {
1301
+ $content = $responseBody->getContents();
1302
+ if ($returnType !== 'string') {
1303
+ $content = json_decode($content);
1304
+ }
1305
+ }
1306
+
1307
+ return [
1308
+ ObjectSerializer::deserialize($content, $returnType, []),
1309
+ $response->getStatusCode(),
1310
+ $response->getHeaders()
1311
+ ];
1312
+
1313
+ } catch (ApiException $e) {
1314
+ switch ($e->getCode()) {
1315
+ case 200:
1316
+ $data = ObjectSerializer::deserialize(
1317
+ $e->getResponseBody(),
1318
+ '\SendinBlue\Client\Model\GetFolderLists',
1319
+ $e->getResponseHeaders()
1320
+ );
1321
+ $e->setResponseObject($data);
1322
+ break;
1323
+ case 400:
1324
+ $data = ObjectSerializer::deserialize(
1325
+ $e->getResponseBody(),
1326
+ '\SendinBlue\Client\Model\ErrorModel',
1327
+ $e->getResponseHeaders()
1328
+ );
1329
+ $e->setResponseObject($data);
1330
+ break;
1331
+ case 404:
1332
+ $data = ObjectSerializer::deserialize(
1333
+ $e->getResponseBody(),
1334
+ '\SendinBlue\Client\Model\ErrorModel',
1335
+ $e->getResponseHeaders()
1336
+ );
1337
+ $e->setResponseObject($data);
1338
+ break;
1339
+ }
1340
+ throw $e;
1341
+ }
1342
+ }
1343
+
1344
+ /**
1345
+ * Operation getFolderListsAsync
1346
+ *
1347
+ * Get the lists in a folder
1348
+ *
1349
+ * @param int $folderId Id of the folder (required)
1350
+ * @param int $limit Number of documents per page (optional, default to 10)
1351
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1352
+ *
1353
+ * @throws \InvalidArgumentException
1354
+ * @return \GuzzleHttp\Promise\PromiseInterface
1355
+ */
1356
+ public function getFolderListsAsync($folderId, $limit = '10', $offset = '0')
1357
+ {
1358
+ return $this->getFolderListsAsyncWithHttpInfo($folderId, $limit, $offset)
1359
+ ->then(
1360
+ function ($response) {
1361
+ return $response[0];
1362
+ }
1363
+ );
1364
+ }
1365
+
1366
+ /**
1367
+ * Operation getFolderListsAsyncWithHttpInfo
1368
+ *
1369
+ * Get the lists in a folder
1370
+ *
1371
+ * @param int $folderId Id of the folder (required)
1372
+ * @param int $limit Number of documents per page (optional, default to 10)
1373
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1374
+ *
1375
+ * @throws \InvalidArgumentException
1376
+ * @return \GuzzleHttp\Promise\PromiseInterface
1377
+ */
1378
+ public function getFolderListsAsyncWithHttpInfo($folderId, $limit = '10', $offset = '0')
1379
+ {
1380
+ $returnType = '\SendinBlue\Client\Model\GetFolderLists';
1381
+ $request = $this->getFolderListsRequest($folderId, $limit, $offset);
1382
+
1383
+ return $this->client
1384
+ ->sendAsync($request, $this->createHttpClientOption())
1385
+ ->then(
1386
+ function ($response) use ($returnType) {
1387
+ $responseBody = $response->getBody();
1388
+ if ($returnType === '\SplFileObject') {
1389
+ $content = $responseBody; //stream goes to serializer
1390
+ } else {
1391
+ $content = $responseBody->getContents();
1392
+ if ($returnType !== 'string') {
1393
+ $content = json_decode($content);
1394
+ }
1395
+ }
1396
+
1397
+ return [
1398
+ ObjectSerializer::deserialize($content, $returnType, []),
1399
+ $response->getStatusCode(),
1400
+ $response->getHeaders()
1401
+ ];
1402
+ },
1403
+ function ($exception) {
1404
+ $response = $exception->getResponse();
1405
+ $statusCode = $response->getStatusCode();
1406
+ throw new ApiException(
1407
+ sprintf(
1408
+ '[%d] Error connecting to the API (%s)',
1409
+ $statusCode,
1410
+ $exception->getRequest()->getUri()
1411
+ ),
1412
+ $statusCode,
1413
+ $response->getHeaders(),
1414
+ $response->getBody()
1415
+ );
1416
+ }
1417
+ );
1418
+ }
1419
+
1420
+ /**
1421
+ * Create request for operation 'getFolderLists'
1422
+ *
1423
+ * @param int $folderId Id of the folder (required)
1424
+ * @param int $limit Number of documents per page (optional, default to 10)
1425
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1426
+ *
1427
+ * @throws \InvalidArgumentException
1428
+ * @return \GuzzleHttp\Psr7\Request
1429
+ */
1430
+ protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0')
1431
+ {
1432
+ // verify the required parameter 'folderId' is set
1433
+ if ($folderId === null) {
1434
+ throw new \InvalidArgumentException(
1435
+ 'Missing the required parameter $folderId when calling getFolderLists'
1436
+ );
1437
+ }
1438
+ if ($limit !== null && $limit > 50) {
1439
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling ListsApi.getFolderLists, must be smaller than or equal to 50.');
1440
+ }
1441
+
1442
+
1443
+ $resourcePath = '/contacts/folders/{folderId}/lists';
1444
+ $formParams = [];
1445
+ $queryParams = [];
1446
+ $headerParams = [];
1447
+ $httpBody = '';
1448
+ $multipart = false;
1449
+
1450
+ // query params
1451
+ if ($limit !== null) {
1452
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
1453
+ }
1454
+ // query params
1455
+ if ($offset !== null) {
1456
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
1457
+ }
1458
+
1459
+ // path params
1460
+ if ($folderId !== null) {
1461
+ $resourcePath = str_replace(
1462
+ '{' . 'folderId' . '}',
1463
+ ObjectSerializer::toPathValue($folderId),
1464
+ $resourcePath
1465
+ );
1466
+ }
1467
+
1468
+ // body params
1469
+ $_tempBody = null;
1470
+
1471
+ if ($multipart) {
1472
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1473
+ ['application/json']
1474
+ );
1475
+ } else {
1476
+ $headers = $this->headerSelector->selectHeaders(
1477
+ ['application/json'],
1478
+ ['application/json']
1479
+ );
1480
+ }
1481
+
1482
+ // for model (json/xml)
1483
+ if (isset($_tempBody)) {
1484
+ // $_tempBody is the method argument, if present
1485
+ $httpBody = $_tempBody;
1486
+ // \stdClass has no __toString(), so we should encode it manually
1487
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1488
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1489
+ }
1490
+ } elseif (count($formParams) > 0) {
1491
+ if ($multipart) {
1492
+ $multipartContents = [];
1493
+ foreach ($formParams as $formParamName => $formParamValue) {
1494
+ $multipartContents[] = [
1495
+ 'name' => $formParamName,
1496
+ 'contents' => $formParamValue
1497
+ ];
1498
+ }
1499
+ // for HTTP post (form)
1500
+ $httpBody = new MultipartStream($multipartContents);
1501
+
1502
+ } elseif ($headers['Content-Type'] === 'application/json') {
1503
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1504
+
1505
+ } else {
1506
+ // for HTTP post (form)
1507
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1508
+ }
1509
+ }
1510
+
1511
+ // this endpoint requires API key authentication
1512
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1513
+ if ($apiKey !== null) {
1514
+ $headers['api-key'] = $apiKey;
1515
+ }
1516
+ // this endpoint requires API key authentication
1517
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1518
+ if ($apiKey !== null) {
1519
+ $headers['partner-key'] = $apiKey;
1520
+ }
1521
+
1522
+ $defaultHeaders = [];
1523
+ if ($this->config->getUserAgent()) {
1524
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1525
+ }
1526
+
1527
+ $headers = array_merge(
1528
+ $defaultHeaders,
1529
+ $headerParams,
1530
+ $headers
1531
+ );
1532
+
1533
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1534
+ return new Request(
1535
+ 'GET',
1536
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1537
+ $headers,
1538
+ $httpBody
1539
+ );
1540
+ }
1541
+
1542
+ /**
1543
+ * Operation getList
1544
+ *
1545
+ * Get the details of a list
1546
+ *
1547
+ * @param int $listId Id of the list (required)
1548
+ *
1549
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1550
+ * @throws \InvalidArgumentException
1551
+ * @return \SendinBlue\Client\Model\GetExtendedList
1552
+ */
1553
+ public function getList($listId)
1554
+ {
1555
+ list($response) = $this->getListWithHttpInfo($listId);
1556
+ return $response;
1557
+ }
1558
+
1559
+ /**
1560
+ * Operation getListWithHttpInfo
1561
+ *
1562
+ * Get the details of a list
1563
+ *
1564
+ * @param int $listId Id of the list (required)
1565
+ *
1566
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1567
+ * @throws \InvalidArgumentException
1568
+ * @return array of \SendinBlue\Client\Model\GetExtendedList, HTTP status code, HTTP response headers (array of strings)
1569
+ */
1570
+ public function getListWithHttpInfo($listId)
1571
+ {
1572
+ $returnType = '\SendinBlue\Client\Model\GetExtendedList';
1573
+ $request = $this->getListRequest($listId);
1574
+
1575
+ try {
1576
+ $options = $this->createHttpClientOption();
1577
+ try {
1578
+ $response = $this->client->send($request, $options);
1579
+ } catch (RequestException $e) {
1580
+ throw new ApiException(
1581
+ "[{$e->getCode()}] {$e->getMessage()}",
1582
+ $e->getCode(),
1583
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1584
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1585
+ );
1586
+ }
1587
+
1588
+ $statusCode = $response->getStatusCode();
1589
+
1590
+ if ($statusCode < 200 || $statusCode > 299) {
1591
+ throw new ApiException(
1592
+ sprintf(
1593
+ '[%d] Error connecting to the API (%s)',
1594
+ $statusCode,
1595
+ $request->getUri()
1596
+ ),
1597
+ $statusCode,
1598
+ $response->getHeaders(),
1599
+ $response->getBody()
1600
+ );
1601
+ }
1602
+
1603
+ $responseBody = $response->getBody();
1604
+ if ($returnType === '\SplFileObject') {
1605
+ $content = $responseBody; //stream goes to serializer
1606
+ } else {
1607
+ $content = $responseBody->getContents();
1608
+ if ($returnType !== 'string') {
1609
+ $content = json_decode($content);
1610
+ }
1611
+ }
1612
+
1613
+ return [
1614
+ ObjectSerializer::deserialize($content, $returnType, []),
1615
+ $response->getStatusCode(),
1616
+ $response->getHeaders()
1617
+ ];
1618
+
1619
+ } catch (ApiException $e) {
1620
+ switch ($e->getCode()) {
1621
+ case 200:
1622
+ $data = ObjectSerializer::deserialize(
1623
+ $e->getResponseBody(),
1624
+ '\SendinBlue\Client\Model\GetExtendedList',
1625
+ $e->getResponseHeaders()
1626
+ );
1627
+ $e->setResponseObject($data);
1628
+ break;
1629
+ case 400:
1630
+ $data = ObjectSerializer::deserialize(
1631
+ $e->getResponseBody(),
1632
+ '\SendinBlue\Client\Model\ErrorModel',
1633
+ $e->getResponseHeaders()
1634
+ );
1635
+ $e->setResponseObject($data);
1636
+ break;
1637
+ case 404:
1638
+ $data = ObjectSerializer::deserialize(
1639
+ $e->getResponseBody(),
1640
+ '\SendinBlue\Client\Model\ErrorModel',
1641
+ $e->getResponseHeaders()
1642
+ );
1643
+ $e->setResponseObject($data);
1644
+ break;
1645
+ }
1646
+ throw $e;
1647
+ }
1648
+ }
1649
+
1650
+ /**
1651
+ * Operation getListAsync
1652
+ *
1653
+ * Get the details of a list
1654
+ *
1655
+ * @param int $listId Id of the list (required)
1656
+ *
1657
+ * @throws \InvalidArgumentException
1658
+ * @return \GuzzleHttp\Promise\PromiseInterface
1659
+ */
1660
+ public function getListAsync($listId)
1661
+ {
1662
+ return $this->getListAsyncWithHttpInfo($listId)
1663
+ ->then(
1664
+ function ($response) {
1665
+ return $response[0];
1666
+ }
1667
+ );
1668
+ }
1669
+
1670
+ /**
1671
+ * Operation getListAsyncWithHttpInfo
1672
+ *
1673
+ * Get the details of a list
1674
+ *
1675
+ * @param int $listId Id of the list (required)
1676
+ *
1677
+ * @throws \InvalidArgumentException
1678
+ * @return \GuzzleHttp\Promise\PromiseInterface
1679
+ */
1680
+ public function getListAsyncWithHttpInfo($listId)
1681
+ {
1682
+ $returnType = '\SendinBlue\Client\Model\GetExtendedList';
1683
+ $request = $this->getListRequest($listId);
1684
+
1685
+ return $this->client
1686
+ ->sendAsync($request, $this->createHttpClientOption())
1687
+ ->then(
1688
+ function ($response) use ($returnType) {
1689
+ $responseBody = $response->getBody();
1690
+ if ($returnType === '\SplFileObject') {
1691
+ $content = $responseBody; //stream goes to serializer
1692
+ } else {
1693
+ $content = $responseBody->getContents();
1694
+ if ($returnType !== 'string') {
1695
+ $content = json_decode($content);
1696
+ }
1697
+ }
1698
+
1699
+ return [
1700
+ ObjectSerializer::deserialize($content, $returnType, []),
1701
+ $response->getStatusCode(),
1702
+ $response->getHeaders()
1703
+ ];
1704
+ },
1705
+ function ($exception) {
1706
+ $response = $exception->getResponse();
1707
+ $statusCode = $response->getStatusCode();
1708
+ throw new ApiException(
1709
+ sprintf(
1710
+ '[%d] Error connecting to the API (%s)',
1711
+ $statusCode,
1712
+ $exception->getRequest()->getUri()
1713
+ ),
1714
+ $statusCode,
1715
+ $response->getHeaders(),
1716
+ $response->getBody()
1717
+ );
1718
+ }
1719
+ );
1720
+ }
1721
+
1722
+ /**
1723
+ * Create request for operation 'getList'
1724
+ *
1725
+ * @param int $listId Id of the list (required)
1726
+ *
1727
+ * @throws \InvalidArgumentException
1728
+ * @return \GuzzleHttp\Psr7\Request
1729
+ */
1730
+ protected function getListRequest($listId)
1731
+ {
1732
+ // verify the required parameter 'listId' is set
1733
+ if ($listId === null) {
1734
+ throw new \InvalidArgumentException(
1735
+ 'Missing the required parameter $listId when calling getList'
1736
+ );
1737
+ }
1738
+
1739
+ $resourcePath = '/contacts/lists/{listId}';
1740
+ $formParams = [];
1741
+ $queryParams = [];
1742
+ $headerParams = [];
1743
+ $httpBody = '';
1744
+ $multipart = false;
1745
+
1746
+
1747
+ // path params
1748
+ if ($listId !== null) {
1749
+ $resourcePath = str_replace(
1750
+ '{' . 'listId' . '}',
1751
+ ObjectSerializer::toPathValue($listId),
1752
+ $resourcePath
1753
+ );
1754
+ }
1755
+
1756
+ // body params
1757
+ $_tempBody = null;
1758
+
1759
+ if ($multipart) {
1760
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1761
+ ['application/json']
1762
+ );
1763
+ } else {
1764
+ $headers = $this->headerSelector->selectHeaders(
1765
+ ['application/json'],
1766
+ ['application/json']
1767
+ );
1768
+ }
1769
+
1770
+ // for model (json/xml)
1771
+ if (isset($_tempBody)) {
1772
+ // $_tempBody is the method argument, if present
1773
+ $httpBody = $_tempBody;
1774
+ // \stdClass has no __toString(), so we should encode it manually
1775
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1776
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1777
+ }
1778
+ } elseif (count($formParams) > 0) {
1779
+ if ($multipart) {
1780
+ $multipartContents = [];
1781
+ foreach ($formParams as $formParamName => $formParamValue) {
1782
+ $multipartContents[] = [
1783
+ 'name' => $formParamName,
1784
+ 'contents' => $formParamValue
1785
+ ];
1786
+ }
1787
+ // for HTTP post (form)
1788
+ $httpBody = new MultipartStream($multipartContents);
1789
+
1790
+ } elseif ($headers['Content-Type'] === 'application/json') {
1791
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1792
+
1793
+ } else {
1794
+ // for HTTP post (form)
1795
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1796
+ }
1797
+ }
1798
+
1799
+ // this endpoint requires API key authentication
1800
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1801
+ if ($apiKey !== null) {
1802
+ $headers['api-key'] = $apiKey;
1803
+ }
1804
+ // this endpoint requires API key authentication
1805
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1806
+ if ($apiKey !== null) {
1807
+ $headers['partner-key'] = $apiKey;
1808
+ }
1809
+
1810
+ $defaultHeaders = [];
1811
+ if ($this->config->getUserAgent()) {
1812
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1813
+ }
1814
+
1815
+ $headers = array_merge(
1816
+ $defaultHeaders,
1817
+ $headerParams,
1818
+ $headers
1819
+ );
1820
+
1821
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1822
+ return new Request(
1823
+ 'GET',
1824
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1825
+ $headers,
1826
+ $httpBody
1827
+ );
1828
+ }
1829
+
1830
+ /**
1831
+ * Operation getLists
1832
+ *
1833
+ * Get all the lists
1834
+ *
1835
+ * @param int $limit Number of documents per page (optional, default to 10)
1836
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1837
+ *
1838
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1839
+ * @throws \InvalidArgumentException
1840
+ * @return \SendinBlue\Client\Model\GetLists
1841
+ */
1842
+ public function getLists($limit = '10', $offset = '0')
1843
+ {
1844
+ list($response) = $this->getListsWithHttpInfo($limit, $offset);
1845
+ return $response;
1846
+ }
1847
+
1848
+ /**
1849
+ * Operation getListsWithHttpInfo
1850
+ *
1851
+ * Get all the lists
1852
+ *
1853
+ * @param int $limit Number of documents per page (optional, default to 10)
1854
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1855
+ *
1856
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1857
+ * @throws \InvalidArgumentException
1858
+ * @return array of \SendinBlue\Client\Model\GetLists, HTTP status code, HTTP response headers (array of strings)
1859
+ */
1860
+ public function getListsWithHttpInfo($limit = '10', $offset = '0')
1861
+ {
1862
+ $returnType = '\SendinBlue\Client\Model\GetLists';
1863
+ $request = $this->getListsRequest($limit, $offset);
1864
+
1865
+ try {
1866
+ $options = $this->createHttpClientOption();
1867
+ try {
1868
+ $response = $this->client->send($request, $options);
1869
+ } catch (RequestException $e) {
1870
+ throw new ApiException(
1871
+ "[{$e->getCode()}] {$e->getMessage()}",
1872
+ $e->getCode(),
1873
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1874
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1875
+ );
1876
+ }
1877
+
1878
+ $statusCode = $response->getStatusCode();
1879
+
1880
+ if ($statusCode < 200 || $statusCode > 299) {
1881
+ throw new ApiException(
1882
+ sprintf(
1883
+ '[%d] Error connecting to the API (%s)',
1884
+ $statusCode,
1885
+ $request->getUri()
1886
+ ),
1887
+ $statusCode,
1888
+ $response->getHeaders(),
1889
+ $response->getBody()
1890
+ );
1891
+ }
1892
+
1893
+ $responseBody = $response->getBody();
1894
+ if ($returnType === '\SplFileObject') {
1895
+ $content = $responseBody; //stream goes to serializer
1896
+ } else {
1897
+ $content = $responseBody->getContents();
1898
+ if ($returnType !== 'string') {
1899
+ $content = json_decode($content);
1900
+ }
1901
+ }
1902
+
1903
+ return [
1904
+ ObjectSerializer::deserialize($content, $returnType, []),
1905
+ $response->getStatusCode(),
1906
+ $response->getHeaders()
1907
+ ];
1908
+
1909
+ } catch (ApiException $e) {
1910
+ switch ($e->getCode()) {
1911
+ case 200:
1912
+ $data = ObjectSerializer::deserialize(
1913
+ $e->getResponseBody(),
1914
+ '\SendinBlue\Client\Model\GetLists',
1915
+ $e->getResponseHeaders()
1916
+ );
1917
+ $e->setResponseObject($data);
1918
+ break;
1919
+ case 400:
1920
+ $data = ObjectSerializer::deserialize(
1921
+ $e->getResponseBody(),
1922
+ '\SendinBlue\Client\Model\ErrorModel',
1923
+ $e->getResponseHeaders()
1924
+ );
1925
+ $e->setResponseObject($data);
1926
+ break;
1927
+ }
1928
+ throw $e;
1929
+ }
1930
+ }
1931
+
1932
+ /**
1933
+ * Operation getListsAsync
1934
+ *
1935
+ * Get all the lists
1936
+ *
1937
+ * @param int $limit Number of documents per page (optional, default to 10)
1938
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1939
+ *
1940
+ * @throws \InvalidArgumentException
1941
+ * @return \GuzzleHttp\Promise\PromiseInterface
1942
+ */
1943
+ public function getListsAsync($limit = '10', $offset = '0')
1944
+ {
1945
+ return $this->getListsAsyncWithHttpInfo($limit, $offset)
1946
+ ->then(
1947
+ function ($response) {
1948
+ return $response[0];
1949
+ }
1950
+ );
1951
+ }
1952
+
1953
+ /**
1954
+ * Operation getListsAsyncWithHttpInfo
1955
+ *
1956
+ * Get all the lists
1957
+ *
1958
+ * @param int $limit Number of documents per page (optional, default to 10)
1959
+ * @param int $offset Index of the first document of the page (optional, default to 0)
1960
+ *
1961
+ * @throws \InvalidArgumentException
1962
+ * @return \GuzzleHttp\Promise\PromiseInterface
1963
+ */
1964
+ public function getListsAsyncWithHttpInfo($limit = '10', $offset = '0')
1965
+ {
1966
+ $returnType = '\SendinBlue\Client\Model\GetLists';
1967
+ $request = $this->getListsRequest($limit, $offset);
1968
+
1969
+ return $this->client
1970
+ ->sendAsync($request, $this->createHttpClientOption())
1971
+ ->then(
1972
+ function ($response) use ($returnType) {
1973
+ $responseBody = $response->getBody();
1974
+ if ($returnType === '\SplFileObject') {
1975
+ $content = $responseBody; //stream goes to serializer
1976
+ } else {
1977
+ $content = $responseBody->getContents();
1978
+ if ($returnType !== 'string') {
1979
+ $content = json_decode($content);
1980
+ }
1981
+ }
1982
+
1983
+ return [
1984
+ ObjectSerializer::deserialize($content, $returnType, []),
1985
+ $response->getStatusCode(),
1986
+ $response->getHeaders()
1987
+ ];
1988
+ },
1989
+ function ($exception) {
1990
+ $response = $exception->getResponse();
1991
+ $statusCode = $response->getStatusCode();
1992
+ throw new ApiException(
1993
+ sprintf(
1994
+ '[%d] Error connecting to the API (%s)',
1995
+ $statusCode,
1996
+ $exception->getRequest()->getUri()
1997
+ ),
1998
+ $statusCode,
1999
+ $response->getHeaders(),
2000
+ $response->getBody()
2001
+ );
2002
+ }
2003
+ );
2004
+ }
2005
+
2006
+ /**
2007
+ * Create request for operation 'getLists'
2008
+ *
2009
+ * @param int $limit Number of documents per page (optional, default to 10)
2010
+ * @param int $offset Index of the first document of the page (optional, default to 0)
2011
+ *
2012
+ * @throws \InvalidArgumentException
2013
+ * @return \GuzzleHttp\Psr7\Request
2014
+ */
2015
+ protected function getListsRequest($limit = '10', $offset = '0')
2016
+ {
2017
+ if ($limit !== null && $limit > 50) {
2018
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling ListsApi.getLists, must be smaller than or equal to 50.');
2019
+ }
2020
+
2021
+
2022
+ $resourcePath = '/contacts/lists';
2023
+ $formParams = [];
2024
+ $queryParams = [];
2025
+ $headerParams = [];
2026
+ $httpBody = '';
2027
+ $multipart = false;
2028
+
2029
+ // query params
2030
+ if ($limit !== null) {
2031
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
2032
+ }
2033
+ // query params
2034
+ if ($offset !== null) {
2035
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
2036
+ }
2037
+
2038
+
2039
+ // body params
2040
+ $_tempBody = null;
2041
+
2042
+ if ($multipart) {
2043
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2044
+ ['application/json']
2045
+ );
2046
+ } else {
2047
+ $headers = $this->headerSelector->selectHeaders(
2048
+ ['application/json'],
2049
+ ['application/json']
2050
+ );
2051
+ }
2052
+
2053
+ // for model (json/xml)
2054
+ if (isset($_tempBody)) {
2055
+ // $_tempBody is the method argument, if present
2056
+ $httpBody = $_tempBody;
2057
+ // \stdClass has no __toString(), so we should encode it manually
2058
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
2059
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
2060
+ }
2061
+ } elseif (count($formParams) > 0) {
2062
+ if ($multipart) {
2063
+ $multipartContents = [];
2064
+ foreach ($formParams as $formParamName => $formParamValue) {
2065
+ $multipartContents[] = [
2066
+ 'name' => $formParamName,
2067
+ 'contents' => $formParamValue
2068
+ ];
2069
+ }
2070
+ // for HTTP post (form)
2071
+ $httpBody = new MultipartStream($multipartContents);
2072
+
2073
+ } elseif ($headers['Content-Type'] === 'application/json') {
2074
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2075
+
2076
+ } else {
2077
+ // for HTTP post (form)
2078
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2079
+ }
2080
+ }
2081
+
2082
+ // this endpoint requires API key authentication
2083
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2084
+ if ($apiKey !== null) {
2085
+ $headers['api-key'] = $apiKey;
2086
+ }
2087
+ // this endpoint requires API key authentication
2088
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2089
+ if ($apiKey !== null) {
2090
+ $headers['partner-key'] = $apiKey;
2091
+ }
2092
+
2093
+ $defaultHeaders = [];
2094
+ if ($this->config->getUserAgent()) {
2095
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2096
+ }
2097
+
2098
+ $headers = array_merge(
2099
+ $defaultHeaders,
2100
+ $headerParams,
2101
+ $headers
2102
+ );
2103
+
2104
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2105
+ return new Request(
2106
+ 'GET',
2107
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2108
+ $headers,
2109
+ $httpBody
2110
+ );
2111
+ }
2112
+
2113
+ /**
2114
+ * Operation removeContactFromList
2115
+ *
2116
+ * Remove existing contacts from a list
2117
+ *
2118
+ * @param int $listId Id of the list (required)
2119
+ * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required)
2120
+ *
2121
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2122
+ * @throws \InvalidArgumentException
2123
+ * @return \SendinBlue\Client\Model\PostContactInfo
2124
+ */
2125
+ public function removeContactFromList($listId, $contactEmails)
2126
+ {
2127
+ list($response) = $this->removeContactFromListWithHttpInfo($listId, $contactEmails);
2128
+ return $response;
2129
+ }
2130
+
2131
+ /**
2132
+ * Operation removeContactFromListWithHttpInfo
2133
+ *
2134
+ * Remove existing contacts from a list
2135
+ *
2136
+ * @param int $listId Id of the list (required)
2137
+ * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required)
2138
+ *
2139
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2140
+ * @throws \InvalidArgumentException
2141
+ * @return array of \SendinBlue\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings)
2142
+ */
2143
+ public function removeContactFromListWithHttpInfo($listId, $contactEmails)
2144
+ {
2145
+ $returnType = '\SendinBlue\Client\Model\PostContactInfo';
2146
+ $request = $this->removeContactFromListRequest($listId, $contactEmails);
2147
+
2148
+ try {
2149
+ $options = $this->createHttpClientOption();
2150
+ try {
2151
+ $response = $this->client->send($request, $options);
2152
+ } catch (RequestException $e) {
2153
+ throw new ApiException(
2154
+ "[{$e->getCode()}] {$e->getMessage()}",
2155
+ $e->getCode(),
2156
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2157
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2158
+ );
2159
+ }
2160
+
2161
+ $statusCode = $response->getStatusCode();
2162
+
2163
+ if ($statusCode < 200 || $statusCode > 299) {
2164
+ throw new ApiException(
2165
+ sprintf(
2166
+ '[%d] Error connecting to the API (%s)',
2167
+ $statusCode,
2168
+ $request->getUri()
2169
+ ),
2170
+ $statusCode,
2171
+ $response->getHeaders(),
2172
+ $response->getBody()
2173
+ );
2174
+ }
2175
+
2176
+ $responseBody = $response->getBody();
2177
+ if ($returnType === '\SplFileObject') {
2178
+ $content = $responseBody; //stream goes to serializer
2179
+ } else {
2180
+ $content = $responseBody->getContents();
2181
+ if ($returnType !== 'string') {
2182
+ $content = json_decode($content);
2183
+ }
2184
+ }
2185
+
2186
+ return [
2187
+ ObjectSerializer::deserialize($content, $returnType, []),
2188
+ $response->getStatusCode(),
2189
+ $response->getHeaders()
2190
+ ];
2191
+
2192
+ } catch (ApiException $e) {
2193
+ switch ($e->getCode()) {
2194
+ case 201:
2195
+ $data = ObjectSerializer::deserialize(
2196
+ $e->getResponseBody(),
2197
+ '\SendinBlue\Client\Model\PostContactInfo',
2198
+ $e->getResponseHeaders()
2199
+ );
2200
+ $e->setResponseObject($data);
2201
+ break;
2202
+ case 400:
2203
+ $data = ObjectSerializer::deserialize(
2204
+ $e->getResponseBody(),
2205
+ '\SendinBlue\Client\Model\ErrorModel',
2206
+ $e->getResponseHeaders()
2207
+ );
2208
+ $e->setResponseObject($data);
2209
+ break;
2210
+ case 404:
2211
+ $data = ObjectSerializer::deserialize(
2212
+ $e->getResponseBody(),
2213
+ '\SendinBlue\Client\Model\ErrorModel',
2214
+ $e->getResponseHeaders()
2215
+ );
2216
+ $e->setResponseObject($data);
2217
+ break;
2218
+ }
2219
+ throw $e;
2220
+ }
2221
+ }
2222
+
2223
+ /**
2224
+ * Operation removeContactFromListAsync
2225
+ *
2226
+ * Remove existing contacts from a list
2227
+ *
2228
+ * @param int $listId Id of the list (required)
2229
+ * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required)
2230
+ *
2231
+ * @throws \InvalidArgumentException
2232
+ * @return \GuzzleHttp\Promise\PromiseInterface
2233
+ */
2234
+ public function removeContactFromListAsync($listId, $contactEmails)
2235
+ {
2236
+ return $this->removeContactFromListAsyncWithHttpInfo($listId, $contactEmails)
2237
+ ->then(
2238
+ function ($response) {
2239
+ return $response[0];
2240
+ }
2241
+ );
2242
+ }
2243
+
2244
+ /**
2245
+ * Operation removeContactFromListAsyncWithHttpInfo
2246
+ *
2247
+ * Remove existing contacts from a list
2248
+ *
2249
+ * @param int $listId Id of the list (required)
2250
+ * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required)
2251
+ *
2252
+ * @throws \InvalidArgumentException
2253
+ * @return \GuzzleHttp\Promise\PromiseInterface
2254
+ */
2255
+ public function removeContactFromListAsyncWithHttpInfo($listId, $contactEmails)
2256
+ {
2257
+ $returnType = '\SendinBlue\Client\Model\PostContactInfo';
2258
+ $request = $this->removeContactFromListRequest($listId, $contactEmails);
2259
+
2260
+ return $this->client
2261
+ ->sendAsync($request, $this->createHttpClientOption())
2262
+ ->then(
2263
+ function ($response) use ($returnType) {
2264
+ $responseBody = $response->getBody();
2265
+ if ($returnType === '\SplFileObject') {
2266
+ $content = $responseBody; //stream goes to serializer
2267
+ } else {
2268
+ $content = $responseBody->getContents();
2269
+ if ($returnType !== 'string') {
2270
+ $content = json_decode($content);
2271
+ }
2272
+ }
2273
+
2274
+ return [
2275
+ ObjectSerializer::deserialize($content, $returnType, []),
2276
+ $response->getStatusCode(),
2277
+ $response->getHeaders()
2278
+ ];
2279
+ },
2280
+ function ($exception) {
2281
+ $response = $exception->getResponse();
2282
+ $statusCode = $response->getStatusCode();
2283
+ throw new ApiException(
2284
+ sprintf(
2285
+ '[%d] Error connecting to the API (%s)',
2286
+ $statusCode,
2287
+ $exception->getRequest()->getUri()
2288
+ ),
2289
+ $statusCode,
2290
+ $response->getHeaders(),
2291
+ $response->getBody()
2292
+ );
2293
+ }
2294
+ );
2295
+ }
2296
+
2297
+ /**
2298
+ * Create request for operation 'removeContactFromList'
2299
+ *
2300
+ * @param int $listId Id of the list (required)
2301
+ * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required)
2302
+ *
2303
+ * @throws \InvalidArgumentException
2304
+ * @return \GuzzleHttp\Psr7\Request
2305
+ */
2306
+ protected function removeContactFromListRequest($listId, $contactEmails)
2307
+ {
2308
+ // verify the required parameter 'listId' is set
2309
+ if ($listId === null) {
2310
+ throw new \InvalidArgumentException(
2311
+ 'Missing the required parameter $listId when calling removeContactFromList'
2312
+ );
2313
+ }
2314
+ // verify the required parameter 'contactEmails' is set
2315
+ if ($contactEmails === null) {
2316
+ throw new \InvalidArgumentException(
2317
+ 'Missing the required parameter $contactEmails when calling removeContactFromList'
2318
+ );
2319
+ }
2320
+
2321
+ $resourcePath = '/contacts/lists/{listId}/contacts/remove';
2322
+ $formParams = [];
2323
+ $queryParams = [];
2324
+ $headerParams = [];
2325
+ $httpBody = '';
2326
+ $multipart = false;
2327
+
2328
+
2329
+ // path params
2330
+ if ($listId !== null) {
2331
+ $resourcePath = str_replace(
2332
+ '{' . 'listId' . '}',
2333
+ ObjectSerializer::toPathValue($listId),
2334
+ $resourcePath
2335
+ );
2336
+ }
2337
+
2338
+ // body params
2339
+ $_tempBody = null;
2340
+ if (isset($contactEmails)) {
2341
+ $_tempBody = $contactEmails;
2342
+ }
2343
+
2344
+ if ($multipart) {
2345
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2346
+ ['application/json']
2347
+ );
2348
+ } else {
2349
+ $headers = $this->headerSelector->selectHeaders(
2350
+ ['application/json'],
2351
+ ['application/json']
2352
+ );
2353
+ }
2354
+
2355
+ // for model (json/xml)
2356
+ if (isset($_tempBody)) {
2357
+ // $_tempBody is the method argument, if present
2358
+ $httpBody = $_tempBody;
2359
+ // \stdClass has no __toString(), so we should encode it manually
2360
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
2361
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
2362
+ }
2363
+ } elseif (count($formParams) > 0) {
2364
+ if ($multipart) {
2365
+ $multipartContents = [];
2366
+ foreach ($formParams as $formParamName => $formParamValue) {
2367
+ $multipartContents[] = [
2368
+ 'name' => $formParamName,
2369
+ 'contents' => $formParamValue
2370
+ ];
2371
+ }
2372
+ // for HTTP post (form)
2373
+ $httpBody = new MultipartStream($multipartContents);
2374
+
2375
+ } elseif ($headers['Content-Type'] === 'application/json') {
2376
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2377
+
2378
+ } else {
2379
+ // for HTTP post (form)
2380
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2381
+ }
2382
+ }
2383
+
2384
+ // this endpoint requires API key authentication
2385
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2386
+ if ($apiKey !== null) {
2387
+ $headers['api-key'] = $apiKey;
2388
+ }
2389
+ // this endpoint requires API key authentication
2390
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2391
+ if ($apiKey !== null) {
2392
+ $headers['partner-key'] = $apiKey;
2393
+ }
2394
+
2395
+ $defaultHeaders = [];
2396
+ if ($this->config->getUserAgent()) {
2397
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2398
+ }
2399
+
2400
+ $headers = array_merge(
2401
+ $defaultHeaders,
2402
+ $headerParams,
2403
+ $headers
2404
+ );
2405
+
2406
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2407
+ return new Request(
2408
+ 'POST',
2409
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2410
+ $headers,
2411
+ $httpBody
2412
+ );
2413
+ }
2414
+
2415
+ /**
2416
+ * Operation updateList
2417
+ *
2418
+ * Update a list
2419
+ *
2420
+ * @param int $listId Id of the list (required)
2421
+ * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required)
2422
+ *
2423
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2424
+ * @throws \InvalidArgumentException
2425
+ * @return void
2426
+ */
2427
+ public function updateList($listId, $updateList)
2428
+ {
2429
+ $this->updateListWithHttpInfo($listId, $updateList);
2430
+ }
2431
+
2432
+ /**
2433
+ * Operation updateListWithHttpInfo
2434
+ *
2435
+ * Update a list
2436
+ *
2437
+ * @param int $listId Id of the list (required)
2438
+ * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required)
2439
+ *
2440
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2441
+ * @throws \InvalidArgumentException
2442
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
2443
+ */
2444
+ public function updateListWithHttpInfo($listId, $updateList)
2445
+ {
2446
+ $returnType = '';
2447
+ $request = $this->updateListRequest($listId, $updateList);
2448
+
2449
+ try {
2450
+ $options = $this->createHttpClientOption();
2451
+ try {
2452
+ $response = $this->client->send($request, $options);
2453
+ } catch (RequestException $e) {
2454
+ throw new ApiException(
2455
+ "[{$e->getCode()}] {$e->getMessage()}",
2456
+ $e->getCode(),
2457
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2458
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2459
+ );
2460
+ }
2461
+
2462
+ $statusCode = $response->getStatusCode();
2463
+
2464
+ if ($statusCode < 200 || $statusCode > 299) {
2465
+ throw new ApiException(
2466
+ sprintf(
2467
+ '[%d] Error connecting to the API (%s)',
2468
+ $statusCode,
2469
+ $request->getUri()
2470
+ ),
2471
+ $statusCode,
2472
+ $response->getHeaders(),
2473
+ $response->getBody()
2474
+ );
2475
+ }
2476
+
2477
+ return [null, $statusCode, $response->getHeaders()];
2478
+
2479
+ } catch (ApiException $e) {
2480
+ switch ($e->getCode()) {
2481
+ case 400:
2482
+ $data = ObjectSerializer::deserialize(
2483
+ $e->getResponseBody(),
2484
+ '\SendinBlue\Client\Model\ErrorModel',
2485
+ $e->getResponseHeaders()
2486
+ );
2487
+ $e->setResponseObject($data);
2488
+ break;
2489
+ case 404:
2490
+ $data = ObjectSerializer::deserialize(
2491
+ $e->getResponseBody(),
2492
+ '\SendinBlue\Client\Model\ErrorModel',
2493
+ $e->getResponseHeaders()
2494
+ );
2495
+ $e->setResponseObject($data);
2496
+ break;
2497
+ }
2498
+ throw $e;
2499
+ }
2500
+ }
2501
+
2502
+ /**
2503
+ * Operation updateListAsync
2504
+ *
2505
+ * Update a list
2506
+ *
2507
+ * @param int $listId Id of the list (required)
2508
+ * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required)
2509
+ *
2510
+ * @throws \InvalidArgumentException
2511
+ * @return \GuzzleHttp\Promise\PromiseInterface
2512
+ */
2513
+ public function updateListAsync($listId, $updateList)
2514
+ {
2515
+ return $this->updateListAsyncWithHttpInfo($listId, $updateList)
2516
+ ->then(
2517
+ function ($response) {
2518
+ return $response[0];
2519
+ }
2520
+ );
2521
+ }
2522
+
2523
+ /**
2524
+ * Operation updateListAsyncWithHttpInfo
2525
+ *
2526
+ * Update a list
2527
+ *
2528
+ * @param int $listId Id of the list (required)
2529
+ * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required)
2530
+ *
2531
+ * @throws \InvalidArgumentException
2532
+ * @return \GuzzleHttp\Promise\PromiseInterface
2533
+ */
2534
+ public function updateListAsyncWithHttpInfo($listId, $updateList)
2535
+ {
2536
+ $returnType = '';
2537
+ $request = $this->updateListRequest($listId, $updateList);
2538
+
2539
+ return $this->client
2540
+ ->sendAsync($request, $this->createHttpClientOption())
2541
+ ->then(
2542
+ function ($response) use ($returnType) {
2543
+ return [null, $response->getStatusCode(), $response->getHeaders()];
2544
+ },
2545
+ function ($exception) {
2546
+ $response = $exception->getResponse();
2547
+ $statusCode = $response->getStatusCode();
2548
+ throw new ApiException(
2549
+ sprintf(
2550
+ '[%d] Error connecting to the API (%s)',
2551
+ $statusCode,
2552
+ $exception->getRequest()->getUri()
2553
+ ),
2554
+ $statusCode,
2555
+ $response->getHeaders(),
2556
+ $response->getBody()
2557
+ );
2558
+ }
2559
+ );
2560
+ }
2561
+
2562
+ /**
2563
+ * Create request for operation 'updateList'
2564
+ *
2565
+ * @param int $listId Id of the list (required)
2566
+ * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required)
2567
+ *
2568
+ * @throws \InvalidArgumentException
2569
+ * @return \GuzzleHttp\Psr7\Request
2570
+ */
2571
+ protected function updateListRequest($listId, $updateList)
2572
+ {
2573
+ // verify the required parameter 'listId' is set
2574
+ if ($listId === null) {
2575
+ throw new \InvalidArgumentException(
2576
+ 'Missing the required parameter $listId when calling updateList'
2577
+ );
2578
+ }
2579
+ // verify the required parameter 'updateList' is set
2580
+ if ($updateList === null) {
2581
+ throw new \InvalidArgumentException(
2582
+ 'Missing the required parameter $updateList when calling updateList'
2583
+ );
2584
+ }
2585
+
2586
+ $resourcePath = '/contacts/lists/{listId}';
2587
+ $formParams = [];
2588
+ $queryParams = [];
2589
+ $headerParams = [];
2590
+ $httpBody = '';
2591
+ $multipart = false;
2592
+
2593
+
2594
+ // path params
2595
+ if ($listId !== null) {
2596
+ $resourcePath = str_replace(
2597
+ '{' . 'listId' . '}',
2598
+ ObjectSerializer::toPathValue($listId),
2599
+ $resourcePath
2600
+ );
2601
+ }
2602
+
2603
+ // body params
2604
+ $_tempBody = null;
2605
+ if (isset($updateList)) {
2606
+ $_tempBody = $updateList;
2607
+ }
2608
+
2609
+ if ($multipart) {
2610
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2611
+ ['application/json']
2612
+ );
2613
+ } else {
2614
+ $headers = $this->headerSelector->selectHeaders(
2615
+ ['application/json'],
2616
+ ['application/json']
2617
+ );
2618
+ }
2619
+
2620
+ // for model (json/xml)
2621
+ if (isset($_tempBody)) {
2622
+ // $_tempBody is the method argument, if present
2623
+ $httpBody = $_tempBody;
2624
+ // \stdClass has no __toString(), so we should encode it manually
2625
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
2626
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
2627
+ }
2628
+ } elseif (count($formParams) > 0) {
2629
+ if ($multipart) {
2630
+ $multipartContents = [];
2631
+ foreach ($formParams as $formParamName => $formParamValue) {
2632
+ $multipartContents[] = [
2633
+ 'name' => $formParamName,
2634
+ 'contents' => $formParamValue
2635
+ ];
2636
+ }
2637
+ // for HTTP post (form)
2638
+ $httpBody = new MultipartStream($multipartContents);
2639
+
2640
+ } elseif ($headers['Content-Type'] === 'application/json') {
2641
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2642
+
2643
+ } else {
2644
+ // for HTTP post (form)
2645
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2646
+ }
2647
+ }
2648
+
2649
+ // this endpoint requires API key authentication
2650
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2651
+ if ($apiKey !== null) {
2652
+ $headers['api-key'] = $apiKey;
2653
+ }
2654
+ // this endpoint requires API key authentication
2655
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2656
+ if ($apiKey !== null) {
2657
+ $headers['partner-key'] = $apiKey;
2658
+ }
2659
+
2660
+ $defaultHeaders = [];
2661
+ if ($this->config->getUserAgent()) {
2662
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2663
+ }
2664
+
2665
+ $headers = array_merge(
2666
+ $defaultHeaders,
2667
+ $headerParams,
2668
+ $headers
2669
+ );
2670
+
2671
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2672
+ return new Request(
2673
+ 'PUT',
2674
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2675
+ $headers,
2676
+ $httpBody
2677
+ );
2678
+ }
2679
+
2680
+ /**
2681
+ * Create http client option
2682
+ *
2683
+ * @throws \RuntimeException on file opening failure
2684
+ * @return array of http client options
2685
+ */
2686
+ protected function createHttpClientOption()
2687
+ {
2688
+ $options = [];
2689
+ if ($this->config->getDebug()) {
2690
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
2691
+ if (!$options[RequestOptions::DEBUG]) {
2692
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
2693
+ }
2694
+ }
2695
+
2696
+ return $options;
2697
+ }
2698
+ }
vendor/sendinblue/api-v3-sdk/lib/Api/ProcessApi.php ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ProcessApi
4
+ * PHP version 5
5
+ *
6
+ * @category Class
7
+ * @package SendinBlue\Client
8
+ * @author Swagger Codegen team
9
+ * @link https://github.com/swagger-api/swagger-codegen
10
+ */
11
+
12
+ /**
13
+ * SendinBlue API
14
+ *
15
+ * SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
16
+ *
17
+ * OpenAPI spec version: 3.0.0
18
+ * Contact: contact@sendinblue.com
19
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
20
+ * Swagger Codegen version: 2.3.1
21
+ */
22
+
23
+ /**
24
+ * NOTE: This class is auto generated by the swagger code generator program.
25
+ * https://github.com/swagger-api/swagger-codegen
26
+ * Do not edit the class manually.
27
+ */
28
+
29
+ namespace SendinBlue\Client\Api;
30
+
31
+ use GuzzleHttp\Client;
32
+ use GuzzleHttp\ClientInterface;
33
+ use GuzzleHttp\Exception\RequestException;
34
+ use GuzzleHttp\Psr7\MultipartStream;
35
+ use GuzzleHttp\Psr7\Request;
36
+ use GuzzleHttp\RequestOptions;
37
+ use SendinBlue\Client\ApiException;
38
+ use SendinBlue\Client\Configuration;
39
+ use SendinBlue\Client\HeaderSelector;
40
+ use SendinBlue\Client\ObjectSerializer;
41
+
42
+ /**
43
+ * ProcessApi Class Doc Comment
44
+ *
45
+ * @category Class
46
+ * @package SendinBlue\Client
47
+ * @author Swagger Codegen team
48
+ * @link https://github.com/swagger-api/swagger-codegen
49
+ */
50
+ class ProcessApi
51
+ {
52
+ /**
53
+ * @var ClientInterface
54
+ */
55
+ protected $client;
56
+
57
+ /**
58
+ * @var Configuration
59
+ */
60
+ protected $config;
61
+
62
+ /**
63
+ * @param ClientInterface $client
64
+ * @param Configuration $config
65
+ * @param HeaderSelector $selector
66
+ */
67
+ public function __construct(
68
+ ClientInterface $client = null,
69
+ Configuration $config = null,
70
+ HeaderSelector $selector = null
71
+ ) {
72
+ $this->client = $client ?: new Client();
73
+ $this->config = $config ?: new Configuration();
74
+ $this->headerSelector = $selector ?: new HeaderSelector();
75
+ }
76
+
77
+ /**
78
+ * @return Configuration
79
+ */
80
+ public function getConfig()
81
+ {
82
+ return $this->config;
83
+ }
84
+
85
+ /**
86
+ * Operation getProcess
87
+ *
88
+ * Return the informations for a process
89
+ *
90
+ * @param int $processId Id of the process (required)
91
+ *
92
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
93
+ * @throws \InvalidArgumentException
94
+ * @return \SendinBlue\Client\Model\GetProcess
95
+ */
96
+ public function getProcess($processId)
97
+ {
98
+ list($response) = $this->getProcessWithHttpInfo($processId);
99
+ return $response;
100
+ }
101
+
102
+ /**
103
+ * Operation getProcessWithHttpInfo
104
+ *
105
+ * Return the informations for a process
106
+ *
107
+ * @param int $processId Id of the process (required)
108
+ *
109
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
110
+ * @throws \InvalidArgumentException
111
+ * @return array of \SendinBlue\Client\Model\GetProcess, HTTP status code, HTTP response headers (array of strings)
112
+ */
113
+ public function getProcessWithHttpInfo($processId)
114
+ {
115
+ $returnType = '\SendinBlue\Client\Model\GetProcess';
116
+ $request = $this->getProcessRequest($processId);
117
+
118
+ try {
119
+ $options = $this->createHttpClientOption();
120
+ try {
121
+ $response = $this->client->send($request, $options);
122
+ } catch (RequestException $e) {
123
+ throw new ApiException(
124
+ "[{$e->getCode()}] {$e->getMessage()}",
125
+ $e->getCode(),
126
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
127
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
128
+ );
129
+ }
130
+
131
+ $statusCode = $response->getStatusCode();
132
+
133
+ if ($statusCode < 200 || $statusCode > 299) {
134
+ throw new ApiException(
135
+ sprintf(
136
+ '[%d] Error connecting to the API (%s)',
137
+ $statusCode,
138
+ $request->getUri()
139
+ ),
140
+ $statusCode,
141
+ $response->getHeaders(),
142
+ $response->getBody()
143
+ );
144
+ }
145
+
146
+ $responseBody = $response->getBody();
147
+ if ($returnType === '\SplFileObject') {
148
+ $content = $responseBody; //stream goes to serializer
149
+ } else {
150
+ $content = $responseBody->getContents();
151
+ if ($returnType !== 'string') {
152
+ $content = json_decode($content);
153
+ }
154
+ }
155
+
156
+ return [
157
+ ObjectSerializer::deserialize($content, $returnType, []),
158
+ $response->getStatusCode(),
159
+ $response->getHeaders()
160
+ ];
161
+
162
+ } catch (ApiException $e) {
163
+ switch ($e->getCode()) {
164
+ case 200:
165
+ $data = ObjectSerializer::deserialize(
166
+ $e->getResponseBody(),
167
+ '\SendinBlue\Client\Model\GetProcess',
168
+ $e->getResponseHeaders()
169
+ );
170
+ $e->setResponseObject($data);
171
+ break;
172
+ case 400:
173
+ $data = ObjectSerializer::deserialize(
174
+ $e->getResponseBody(),
175
+ '\SendinBlue\Client\Model\ErrorModel',
176
+ $e->getResponseHeaders()
177
+ );
178
+ $e->setResponseObject($data);
179
+ break;
180
+ case 404:
181
+ $data = ObjectSerializer::deserialize(
182
+ $e->getResponseBody(),
183
+ '\SendinBlue\Client\Model\ErrorModel',
184
+ $e->getResponseHeaders()
185
+ );
186
+ $e->setResponseObject($data);
187
+ break;
188
+ }
189
+ throw $e;
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Operation getProcessAsync
195
+ *
196
+ * Return the informations for a process
197
+ *
198
+ * @param int $processId Id of the process (required)
199
+ *
200
+ * @throws \InvalidArgumentException
201
+ * @return \GuzzleHttp\Promise\PromiseInterface
202
+ */
203
+ public function getProcessAsync($processId)
204
+ {
205
+ return $this->getProcessAsyncWithHttpInfo($processId)
206
+ ->then(
207
+ function ($response) {
208
+ return $response[0];
209
+ }
210
+ );
211
+ }
212
+
213
+ /**
214
+ * Operation getProcessAsyncWithHttpInfo
215
+ *
216
+ * Return the informations for a process
217
+ *
218
+ * @param int $processId Id of the process (required)
219
+ *
220
+ * @throws \InvalidArgumentException
221
+ * @return \GuzzleHttp\Promise\PromiseInterface
222
+ */
223
+ public function getProcessAsyncWithHttpInfo($processId)
224
+ {
225
+ $returnType = '\SendinBlue\Client\Model\GetProcess';
226
+ $request = $this->getProcessRequest($processId);
227
+
228
+ return $this->client
229
+ ->sendAsync($request, $this->createHttpClientOption())
230
+ ->then(
231
+ function ($response) use ($returnType) {
232
+ $responseBody = $response->getBody();
233
+ if ($returnType === '\SplFileObject') {
234
+ $content = $responseBody; //stream goes to serializer
235
+ } else {
236
+ $content = $responseBody->getContents();
237
+ if ($returnType !== 'string') {
238
+ $content = json_decode($content);
239
+ }
240
+ }
241
+
242
+ return [
243
+ ObjectSerializer::deserialize($content, $returnType, []),
244
+ $response->getStatusCode(),
245
+ $response->getHeaders()
246
+ ];
247
+ },
248
+ function ($exception) {
249
+ $response = $exception->getResponse();
250
+ $statusCode = $response->getStatusCode();
251
+ throw new ApiException(
252
+ sprintf(
253
+ '[%d] Error connecting to the API (%s)',
254
+ $statusCode,
255
+ $exception->getRequest()->getUri()
256
+ ),
257
+ $statusCode,
258
+ $response->getHeaders(),
259
+ $response->getBody()
260
+ );
261
+ }
262
+ );
263
+ }
264
+
265
+ /**
266
+ * Create request for operation 'getProcess'
267
+ *
268
+ * @param int $processId Id of the process (required)
269
+ *
270
+ * @throws \InvalidArgumentException
271
+ * @return \GuzzleHttp\Psr7\Request
272
+ */
273
+ protected function getProcessRequest($processId)
274
+ {
275
+ // verify the required parameter 'processId' is set
276
+ if ($processId === null) {
277
+ throw new \InvalidArgumentException(
278
+ 'Missing the required parameter $processId when calling getProcess'
279
+ );
280
+ }
281
+
282
+ $resourcePath = '/processes/{processId}';
283
+ $formParams = [];
284
+ $queryParams = [];
285
+ $headerParams = [];
286
+ $httpBody = '';
287
+ $multipart = false;
288
+
289
+
290
+ // path params
291
+ if ($processId !== null) {
292
+ $resourcePath = str_replace(
293
+ '{' . 'processId' . '}',
294
+ ObjectSerializer::toPathValue($processId),
295
+ $resourcePath
296
+ );
297
+ }
298
+
299
+ // body params
300
+ $_tempBody = null;
301
+
302
+ if ($multipart) {
303
+ $headers = $this->headerSelector->selectHeadersForMultipart(
304
+ ['application/json']
305
+ );
306
+ } else {
307
+ $headers = $this->headerSelector->selectHeaders(
308
+ ['application/json'],
309
+ ['application/json']
310
+ );
311
+ }
312
+
313
+ // for model (json/xml)
314
+ if (isset($_tempBody)) {
315
+ // $_tempBody is the method argument, if present
316
+ $httpBody = $_tempBody;
317
+ // \stdClass has no __toString(), so we should encode it manually
318
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
319
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
320
+ }
321
+ } elseif (count($formParams) > 0) {
322
+ if ($multipart) {
323
+ $multipartContents = [];
324
+ foreach ($formParams as $formParamName => $formParamValue) {
325
+ $multipartContents[] = [
326
+ 'name' => $formParamName,
327
+ 'contents' => $formParamValue
328
+ ];
329
+ }
330
+ // for HTTP post (form)
331
+ $httpBody = new MultipartStream($multipartContents);
332
+
333
+ } elseif ($headers['Content-Type'] === 'application/json') {
334
+ $httpBody = \GuzzleHttp\json_encode($formParams);
335
+
336
+ } else {
337
+ // for HTTP post (form)
338
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
339
+ }
340
+ }
341
+
342
+ // this endpoint requires API key authentication
343
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
344
+ if ($apiKey !== null) {
345
+ $headers['api-key'] = $apiKey;
346
+ }
347
+ // this endpoint requires API key authentication
348
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
349
+ if ($apiKey !== null) {
350
+ $headers['partner-key'] = $apiKey;
351
+ }
352
+
353
+ $defaultHeaders = [];
354
+ if ($this->config->getUserAgent()) {
355
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
356
+ }
357
+
358
+ $headers = array_merge(
359
+ $defaultHeaders,
360
+ $headerParams,
361
+ $headers
362
+ );
363
+
364
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
365
+ return new Request(
366
+ 'GET',
367
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
368
+ $headers,
369
+ $httpBody
370
+ );
371
+ }
372
+
373
+ /**
374
+ * Operation getProcesses
375
+ *
376
+ * Return all the processes for your account
377
+ *
378
+ * @param int $limit Number limitation for the result returned (optional, default to 10)
379
+ * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0)
380
+ *
381
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
382
+ * @throws \InvalidArgumentException
383
+ * @return \SendinBlue\Client\Model\GetProcesses
384
+ */
385
+ public function getProcesses($limit = '10', $offset = '0')
386
+ {
387
+ list($response) = $this->getProcessesWithHttpInfo($limit, $offset);
388
+ return $response;
389
+ }
390
+
391
+ /**
392
+ * Operation getProcessesWithHttpInfo
393
+ *
394
+ * Return all the processes for your account
395
+ *
396
+ * @param int $limit Number limitation for the result returned (optional, default to 10)
397
+ * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0)
398
+ *
399
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
400
+ * @throws \InvalidArgumentException
401
+ * @return array of \SendinBlue\Client\Model\GetProcesses, HTTP status code, HTTP response headers (array of strings)
402
+ */
403
+ public function getProcessesWithHttpInfo($limit = '10', $offset = '0')
404
+ {
405
+ $returnType = '\SendinBlue\Client\Model\GetProcesses';
406
+ $request = $this->getProcessesRequest($limit, $offset);
407
+
408
+ try {
409
+ $options = $this->createHttpClientOption();
410
+ try {
411
+ $response = $this->client->send($request, $options);
412
+ } catch (RequestException $e) {
413
+ throw new ApiException(
414
+ "[{$e->getCode()}] {$e->getMessage()}",
415
+ $e->getCode(),
416
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
417
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
418
+ );
419
+ }
420
+
421
+ $statusCode = $response->getStatusCode();
422
+
423
+ if ($statusCode < 200 || $statusCode > 299) {
424
+ throw new ApiException(
425
+ sprintf(
426
+ '[%d] Error connecting to the API (%s)',
427
+ $statusCode,
428
+ $request->getUri()
429
+ ),
430
+ $statusCode,
431
+ $response->getHeaders(),
432
+ $response->getBody()
433
+ );
434
+ }
435
+
436
+ $responseBody = $response->getBody();
437
+ if ($returnType === '\SplFileObject') {
438
+ $content = $responseBody; //stream goes to serializer
439
+ } else {
440
+ $content = $responseBody->getContents();
441
+ if ($returnType !== 'string') {
442
+ $content = json_decode($content);
443
+ }
444
+ }
445
+
446
+ return [
447
+ ObjectSerializer::deserialize($content, $returnType, []),
448
+ $response->getStatusCode(),
449
+ $response->getHeaders()
450
+ ];
451
+
452
+ } catch (ApiException $e) {
453
+ switch ($e->getCode()) {
454
+ case 200:
455
+ $data = ObjectSerializer::deserialize(
456
+ $e->getResponseBody(),
457
+ '\SendinBlue\Client\Model\GetProcesses',
458
+ $e->getResponseHeaders()
459
+ );
460
+ $e->setResponseObject($data);
461
+ break;
462
+ case 400:
463
+ $data = ObjectSerializer::deserialize(
464
+ $e->getResponseBody(),
465
+ '\SendinBlue\Client\Model\ErrorModel',
466
+ $e->getResponseHeaders()
467
+ );
468
+ $e->setResponseObject($data);
469
+ break;
470
+ }
471
+ throw $e;
472
+ }
473
+ }
474
+
475
+ /**
476
+ * Operation getProcessesAsync
477
+ *
478
+ * Return all the processes for your account
479
+ *
480
+ * @param int $limit Number limitation for the result returned (optional, default to 10)
481
+ * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0)
482
+ *
483
+ * @throws \InvalidArgumentException
484
+ * @return \GuzzleHttp\Promise\PromiseInterface
485
+ */
486
+ public function getProcessesAsync($limit = '10', $offset = '0')
487
+ {
488
+ return $this->getProcessesAsyncWithHttpInfo($limit, $offset)
489
+ ->then(
490
+ function ($response) {
491
+ return $response[0];
492
+ }
493
+ );
494
+ }
495
+
496
+ /**
497
+ * Operation getProcessesAsyncWithHttpInfo
498
+ *
499
+ * Return all the processes for your account
500
+ *
501
+ * @param int $limit Number limitation for the result returned (optional, default to 10)
502
+ * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0)
503
+ *
504
+ * @throws \InvalidArgumentException
505
+ * @return \GuzzleHttp\Promise\PromiseInterface
506
+ */
507
+ public function getProcessesAsyncWithHttpInfo($limit = '10', $offset = '0')
508
+ {
509
+ $returnType = '\SendinBlue\Client\Model\GetProcesses';
510
+ $request = $this->getProcessesRequest($limit, $offset);
511
+
512
+ return $this->client
513
+ ->sendAsync($request, $this->createHttpClientOption())
514
+ ->then(
515
+ function ($response) use ($returnType) {
516
+ $responseBody = $response->getBody();
517
+ if ($returnType === '\SplFileObject') {
518
+ $content = $responseBody; //stream goes to serializer
519
+ } else {
520
+ $content = $responseBody->getContents();
521
+ if ($returnType !== 'string') {
522
+ $content = json_decode($content);
523
+ }
524
+ }
525
+
526
+ return [
527
+ ObjectSerializer::deserialize($content, $returnType, []),
528
+ $response->getStatusCode(),
529
+ $response->getHeaders()
530
+ ];
531
+ },
532
+ function ($exception) {
533
+ $response = $exception->getResponse();
534
+ $statusCode = $response->getStatusCode();
535
+ throw new ApiException(
536
+ sprintf(
537
+ '[%d] Error connecting to the API (%s)',
538
+ $statusCode,
539
+ $exception->getRequest()->getUri()
540
+ ),
541
+ $statusCode,
542
+ $response->getHeaders(),
543
+ $response->getBody()
544
+ );
545
+ }
546
+ );
547
+ }
548
+
549
+ /**
550
+ * Create request for operation 'getProcesses'
551
+ *
552
+ * @param int $limit Number limitation for the result returned (optional, default to 10)
553
+ * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0)
554
+ *
555
+ * @throws \InvalidArgumentException
556
+ * @return \GuzzleHttp\Psr7\Request
557
+ */
558
+ protected function getProcessesRequest($limit = '10', $offset = '0')
559
+ {
560
+ if ($limit !== null && $limit > 50) {
561
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling ProcessApi.getProcesses, must be smaller than or equal to 50.');
562
+ }
563
+
564
+
565
+ $resourcePath = '/processes';
566
+ $formParams = [];
567
+ $queryParams = [];
568
+ $headerParams = [];
569
+ $httpBody = '';
570
+ $multipart = false;
571
+
572
+ // query params
573
+ if ($limit !== null) {
574
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
575
+ }
576
+ // query params
577
+ if ($offset !== null) {
578
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
579
+ }
580
+
581
+
582
+ // body params
583
+ $_tempBody = null;
584
+
585
+ if ($multipart) {
586
+ $headers = $this->headerSelector->selectHeadersForMultipart(
587
+ ['application/json']
588
+ );
589
+ } else {
590
+ $headers = $this->headerSelector->selectHeaders(
591
+ ['application/json'],
592
+ ['application/json']
593
+ );
594
+ }
595
+
596
+ // for model (json/xml)
597
+ if (isset($_tempBody)) {
598
+ // $_tempBody is the method argument, if present
599
+ $httpBody = $_tempBody;
600
+ // \stdClass has no __toString(), so we should encode it manually
601
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
602
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
603
+ }
604
+ } elseif (count($formParams) > 0) {
605
+ if ($multipart) {
606
+ $multipartContents = [];
607
+ foreach ($formParams as $formParamName => $formParamValue) {
608
+ $multipartContents[] = [
609
+ 'name' => $formParamName,
610
+ 'contents' => $formParamValue
611
+ ];
612
+ }
613
+ // for HTTP post (form)
614
+ $httpBody = new MultipartStream($multipartContents);
615
+
616
+ } elseif ($headers['Content-Type'] === 'application/json') {
617
+ $httpBody = \GuzzleHttp\json_encode($formParams);
618
+
619
+ } else {
620
+ // for HTTP post (form)
621
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
622
+ }
623
+ }
624
+
625
+ // this endpoint requires API key authentication
626
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
627
+ if ($apiKey !== null) {
628
+ $headers['api-key'] = $apiKey;
629
+ }
630
+ // this endpoint requires API key authentication
631
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
632
+ if ($apiKey !== null) {
633
+ $headers['partner-key'] = $apiKey;
634
+ }
635
+
636
+ $defaultHeaders = [];
637
+ if ($this->config->getUserAgent()) {
638
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
639
+ }
640
+
641
+ $headers = array_merge(
642
+ $defaultHeaders,
643
+ $headerParams,
644
+ $headers
645
+ );
646
+
647
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
648
+ return new Request(
649
+ 'GET',
650
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
651
+ $headers,
652
+ $httpBody
653
+ );
654
+ }
655
+
656
+ /**
657
+ * Create http client option
658
+ *
659
+ * @throws \RuntimeException on file opening failure
660
+ * @return array of http client options
661
+ */
662
+ protected function createHttpClientOption()
663
+ {
664
+ $options = [];
665
+ if ($this->config->getDebug()) {
666
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
667
+ if (!$options[RequestOptions::DEBUG]) {
668
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
669
+ }
670
+ }
671
+
672
+ return $options;
673
+ }
674
+ }
vendor/sendinblue/api-v3-sdk/lib/Api/ResellerApi.php ADDED
@@ -0,0 +1,4327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ResellerApi
4
+ * PHP version 5
5
+ *
6
+ * @category Class
7
+ * @package SendinBlue\Client
8
+ * @author Swagger Codegen team
9
+ * @link https://github.com/swagger-api/swagger-codegen
10
+ */
11
+
12
+ /**
13
+ * SendinBlue API
14
+ *
15
+ * SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
16
+ *
17
+ * OpenAPI spec version: 3.0.0
18
+ * Contact: contact@sendinblue.com
19
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
20
+ * Swagger Codegen version: 2.3.1
21
+ */
22
+
23
+ /**
24
+ * NOTE: This class is auto generated by the swagger code generator program.
25
+ * https://github.com/swagger-api/swagger-codegen
26
+ * Do not edit the class manually.
27
+ */
28
+
29
+ namespace SendinBlue\Client\Api;
30
+
31
+ use GuzzleHttp\Client;
32
+ use GuzzleHttp\ClientInterface;
33
+ use GuzzleHttp\Exception\RequestException;
34
+ use GuzzleHttp\Psr7\MultipartStream;
35
+ use GuzzleHttp\Psr7\Request;
36
+ use GuzzleHttp\RequestOptions;
37
+ use SendinBlue\Client\ApiException;
38
+ use SendinBlue\Client\Configuration;
39
+ use SendinBlue\Client\HeaderSelector;
40
+ use SendinBlue\Client\ObjectSerializer;
41
+
42
+ /**
43
+ * ResellerApi Class Doc Comment
44
+ *
45
+ * @category Class
46
+ * @package SendinBlue\Client
47
+ * @author Swagger Codegen team
48
+ * @link https://github.com/swagger-api/swagger-codegen
49
+ */
50
+ class ResellerApi
51
+ {
52
+ /**
53
+ * @var ClientInterface
54
+ */
55
+ protected $client;
56
+
57
+ /**
58
+ * @var Configuration
59
+ */
60
+ protected $config;
61
+
62
+ /**
63
+ * @param ClientInterface $client
64
+ * @param Configuration $config
65
+ * @param HeaderSelector $selector
66
+ */
67
+ public function __construct(
68
+ ClientInterface $client = null,
69
+ Configuration $config = null,
70
+ HeaderSelector $selector = null
71
+ ) {
72
+ $this->client = $client ?: new Client();
73
+ $this->config = $config ?: new Configuration();
74
+ $this->headerSelector = $selector ?: new HeaderSelector();
75
+ }
76
+
77
+ /**
78
+ * @return Configuration
79
+ */
80
+ public function getConfig()
81
+ {
82
+ return $this->config;
83
+ }
84
+
85
+ /**
86
+ * Operation addCredits
87
+ *
88
+ * Add Email and/or SMS credits to a specific child account
89
+ *
90
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
91
+ * @param \SendinBlue\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required)
92
+ *
93
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
94
+ * @throws \InvalidArgumentException
95
+ * @return \SendinBlue\Client\Model\RemainingCreditModel
96
+ */
97
+ public function addCredits($childAuthKey, $addCredits)
98
+ {
99
+ list($response) = $this->addCreditsWithHttpInfo($childAuthKey, $addCredits);
100
+ return $response;
101
+ }
102
+
103
+ /**
104
+ * Operation addCreditsWithHttpInfo
105
+ *
106
+ * Add Email and/or SMS credits to a specific child account
107
+ *
108
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
109
+ * @param \SendinBlue\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required)
110
+ *
111
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
112
+ * @throws \InvalidArgumentException
113
+ * @return array of \SendinBlue\Client\Model\RemainingCreditModel, HTTP status code, HTTP response headers (array of strings)
114
+ */
115
+ public function addCreditsWithHttpInfo($childAuthKey, $addCredits)
116
+ {
117
+ $returnType = '\SendinBlue\Client\Model\RemainingCreditModel';
118
+ $request = $this->addCreditsRequest($childAuthKey, $addCredits);
119
+
120
+ try {
121
+ $options = $this->createHttpClientOption();
122
+ try {
123
+ $response = $this->client->send($request, $options);
124
+ } catch (RequestException $e) {
125
+ throw new ApiException(
126
+ "[{$e->getCode()}] {$e->getMessage()}",
127
+ $e->getCode(),
128
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
129
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
130
+ );
131
+ }
132
+
133
+ $statusCode = $response->getStatusCode();
134
+
135
+ if ($statusCode < 200 || $statusCode > 299) {
136
+ throw new ApiException(
137
+ sprintf(
138
+ '[%d] Error connecting to the API (%s)',
139
+ $statusCode,
140
+ $request->getUri()
141
+ ),
142
+ $statusCode,
143
+ $response->getHeaders(),
144
+ $response->getBody()
145
+ );
146
+ }
147
+
148
+ $responseBody = $response->getBody();
149
+ if ($returnType === '\SplFileObject') {
150
+ $content = $responseBody; //stream goes to serializer
151
+ } else {
152
+ $content = $responseBody->getContents();
153
+ if ($returnType !== 'string') {
154
+ $content = json_decode($content);
155
+ }
156
+ }
157
+
158
+ return [
159
+ ObjectSerializer::deserialize($content, $returnType, []),
160
+ $response->getStatusCode(),
161
+ $response->getHeaders()
162
+ ];
163
+
164
+ } catch (ApiException $e) {
165
+ switch ($e->getCode()) {
166
+ case 200:
167
+ $data = ObjectSerializer::deserialize(
168
+ $e->getResponseBody(),
169
+ '\SendinBlue\Client\Model\RemainingCreditModel',
170
+ $e->getResponseHeaders()
171
+ );
172
+ $e->setResponseObject($data);
173
+ break;
174
+ case 400:
175
+ $data = ObjectSerializer::deserialize(
176
+ $e->getResponseBody(),
177
+ '\SendinBlue\Client\Model\ErrorModel',
178
+ $e->getResponseHeaders()
179
+ );
180
+ $e->setResponseObject($data);
181
+ break;
182
+ case 403:
183
+ $data = ObjectSerializer::deserialize(
184
+ $e->getResponseBody(),
185
+ '\SendinBlue\Client\Model\ErrorModel',
186
+ $e->getResponseHeaders()
187
+ );
188
+ $e->setResponseObject($data);
189
+ break;
190
+ case 404:
191
+ $data = ObjectSerializer::deserialize(
192
+ $e->getResponseBody(),
193
+ '\SendinBlue\Client\Model\ErrorModel',
194
+ $e->getResponseHeaders()
195
+ );
196
+ $e->setResponseObject($data);
197
+ break;
198
+ }
199
+ throw $e;
200
+ }
201
+ }
202
+
203
+ /**
204
+ * Operation addCreditsAsync
205
+ *
206
+ * Add Email and/or SMS credits to a specific child account
207
+ *
208
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
209
+ * @param \SendinBlue\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required)
210
+ *
211
+ * @throws \InvalidArgumentException
212
+ * @return \GuzzleHttp\Promise\PromiseInterface
213
+ */
214
+ public function addCreditsAsync($childAuthKey, $addCredits)
215
+ {
216
+ return $this->addCreditsAsyncWithHttpInfo($childAuthKey, $addCredits)
217
+ ->then(
218
+ function ($response) {
219
+ return $response[0];
220
+ }
221
+ );
222
+ }
223
+
224
+ /**
225
+ * Operation addCreditsAsyncWithHttpInfo
226
+ *
227
+ * Add Email and/or SMS credits to a specific child account
228
+ *
229
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
230
+ * @param \SendinBlue\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required)
231
+ *
232
+ * @throws \InvalidArgumentException
233
+ * @return \GuzzleHttp\Promise\PromiseInterface
234
+ */
235
+ public function addCreditsAsyncWithHttpInfo($childAuthKey, $addCredits)
236
+ {
237
+ $returnType = '\SendinBlue\Client\Model\RemainingCreditModel';
238
+ $request = $this->addCreditsRequest($childAuthKey, $addCredits);
239
+
240
+ return $this->client
241
+ ->sendAsync($request, $this->createHttpClientOption())
242
+ ->then(
243
+ function ($response) use ($returnType) {
244
+ $responseBody = $response->getBody();
245
+ if ($returnType === '\SplFileObject') {
246
+ $content = $responseBody; //stream goes to serializer
247
+ } else {
248
+ $content = $responseBody->getContents();
249
+ if ($returnType !== 'string') {
250
+ $content = json_decode($content);
251
+ }
252
+ }
253
+
254
+ return [
255
+ ObjectSerializer::deserialize($content, $returnType, []),
256
+ $response->getStatusCode(),
257
+ $response->getHeaders()
258
+ ];
259
+ },
260
+ function ($exception) {
261
+ $response = $exception->getResponse();
262
+ $statusCode = $response->getStatusCode();
263
+ throw new ApiException(
264
+ sprintf(
265
+ '[%d] Error connecting to the API (%s)',
266
+ $statusCode,
267
+ $exception->getRequest()->getUri()
268
+ ),
269
+ $statusCode,
270
+ $response->getHeaders(),
271
+ $response->getBody()
272
+ );
273
+ }
274
+ );
275
+ }
276
+
277
+ /**
278
+ * Create request for operation 'addCredits'
279
+ *
280
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
281
+ * @param \SendinBlue\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required)
282
+ *
283
+ * @throws \InvalidArgumentException
284
+ * @return \GuzzleHttp\Psr7\Request
285
+ */
286
+ protected function addCreditsRequest($childAuthKey, $addCredits)
287
+ {
288
+ // verify the required parameter 'childAuthKey' is set
289
+ if ($childAuthKey === null) {
290
+ throw new \InvalidArgumentException(
291
+ 'Missing the required parameter $childAuthKey when calling addCredits'
292
+ );
293
+ }
294
+ // verify the required parameter 'addCredits' is set
295
+ if ($addCredits === null) {
296
+ throw new \InvalidArgumentException(
297
+ 'Missing the required parameter $addCredits when calling addCredits'
298
+ );
299
+ }
300
+
301
+ $resourcePath = '/reseller/children/{childAuthKey}/credits/add';
302
+ $formParams = [];
303
+ $queryParams = [];
304
+ $headerParams = [];
305
+ $httpBody = '';
306
+ $multipart = false;
307
+
308
+
309
+ // path params
310
+ if ($childAuthKey !== null) {
311
+ $resourcePath = str_replace(
312
+ '{' . 'childAuthKey' . '}',
313
+ ObjectSerializer::toPathValue($childAuthKey),
314
+ $resourcePath
315
+ );
316
+ }
317
+
318
+ // body params
319
+ $_tempBody = null;
320
+ if (isset($addCredits)) {
321
+ $_tempBody = $addCredits;
322
+ }
323
+
324
+ if ($multipart) {
325
+ $headers = $this->headerSelector->selectHeadersForMultipart(
326
+ ['application/json']
327
+ );
328
+ } else {
329
+ $headers = $this->headerSelector->selectHeaders(
330
+ ['application/json'],
331
+ ['application/json']
332
+ );
333
+ }
334
+
335
+ // for model (json/xml)
336
+ if (isset($_tempBody)) {
337
+ // $_tempBody is the method argument, if present
338
+ $httpBody = $_tempBody;
339
+ // \stdClass has no __toString(), so we should encode it manually
340
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
341
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
342
+ }
343
+ } elseif (count($formParams) > 0) {
344
+ if ($multipart) {
345
+ $multipartContents = [];
346
+ foreach ($formParams as $formParamName => $formParamValue) {
347
+ $multipartContents[] = [
348
+ 'name' => $formParamName,
349
+ 'contents' => $formParamValue
350
+ ];
351
+ }
352
+ // for HTTP post (form)
353
+ $httpBody = new MultipartStream($multipartContents);
354
+
355
+ } elseif ($headers['Content-Type'] === 'application/json') {
356
+ $httpBody = \GuzzleHttp\json_encode($formParams);
357
+
358
+ } else {
359
+ // for HTTP post (form)
360
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
361
+ }
362
+ }
363
+
364
+ // this endpoint requires API key authentication
365
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
366
+ if ($apiKey !== null) {
367
+ $headers['api-key'] = $apiKey;
368
+ }
369
+ // this endpoint requires API key authentication
370
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
371
+ if ($apiKey !== null) {
372
+ $headers['partner-key'] = $apiKey;
373
+ }
374
+
375
+ $defaultHeaders = [];
376
+ if ($this->config->getUserAgent()) {
377
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
378
+ }
379
+
380
+ $headers = array_merge(
381
+ $defaultHeaders,
382
+ $headerParams,
383
+ $headers
384
+ );
385
+
386
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
387
+ return new Request(
388
+ 'POST',
389
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
390
+ $headers,
391
+ $httpBody
392
+ );
393
+ }
394
+
395
+ /**
396
+ * Operation associateIpToChild
397
+ *
398
+ * Associate a dedicated IP to the child
399
+ *
400
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
401
+ * @param \SendinBlue\Client\Model\ManageIp $ip IP to associate (required)
402
+ *
403
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
404
+ * @throws \InvalidArgumentException
405
+ * @return void
406
+ */
407
+ public function associateIpToChild($childAuthKey, $ip)
408
+ {
409
+ $this->associateIpToChildWithHttpInfo($childAuthKey, $ip);
410
+ }
411
+
412
+ /**
413
+ * Operation associateIpToChildWithHttpInfo
414
+ *
415
+ * Associate a dedicated IP to the child
416
+ *
417
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
418
+ * @param \SendinBlue\Client\Model\ManageIp $ip IP to associate (required)
419
+ *
420
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
421
+ * @throws \InvalidArgumentException
422
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
423
+ */
424
+ public function associateIpToChildWithHttpInfo($childAuthKey, $ip)
425
+ {
426
+ $returnType = '';
427
+ $request = $this->associateIpToChildRequest($childAuthKey, $ip);
428
+
429
+ try {
430
+ $options = $this->createHttpClientOption();
431
+ try {
432
+ $response = $this->client->send($request, $options);
433
+ } catch (RequestException $e) {
434
+ throw new ApiException(
435
+ "[{$e->getCode()}] {$e->getMessage()}",
436
+ $e->getCode(),
437
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
438
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
439
+ );
440
+ }
441
+
442
+ $statusCode = $response->getStatusCode();
443
+
444
+ if ($statusCode < 200 || $statusCode > 299) {
445
+ throw new ApiException(
446
+ sprintf(
447
+ '[%d] Error connecting to the API (%s)',
448
+ $statusCode,
449
+ $request->getUri()
450
+ ),
451
+ $statusCode,
452
+ $response->getHeaders(),
453
+ $response->getBody()
454
+ );
455
+ }
456
+
457
+ return [null, $statusCode, $response->getHeaders()];
458
+
459
+ } catch (ApiException $e) {
460
+ switch ($e->getCode()) {
461
+ case 400:
462
+ $data = ObjectSerializer::deserialize(
463
+ $e->getResponseBody(),
464
+ '\SendinBlue\Client\Model\ErrorModel',
465
+ $e->getResponseHeaders()
466
+ );
467
+ $e->setResponseObject($data);
468
+ break;
469
+ case 404:
470
+ $data = ObjectSerializer::deserialize(
471
+ $e->getResponseBody(),
472
+ '\SendinBlue\Client\Model\ErrorModel',
473
+ $e->getResponseHeaders()
474
+ );
475
+ $e->setResponseObject($data);
476
+ break;
477
+ }
478
+ throw $e;
479
+ }
480
+ }
481
+
482
+ /**
483
+ * Operation associateIpToChildAsync
484
+ *
485
+ * Associate a dedicated IP to the child
486
+ *
487
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
488
+ * @param \SendinBlue\Client\Model\ManageIp $ip IP to associate (required)
489
+ *
490
+ * @throws \InvalidArgumentException
491
+ * @return \GuzzleHttp\Promise\PromiseInterface
492
+ */
493
+ public function associateIpToChildAsync($childAuthKey, $ip)
494
+ {
495
+ return $this->associateIpToChildAsyncWithHttpInfo($childAuthKey, $ip)
496
+ ->then(
497
+ function ($response) {
498
+ return $response[0];
499
+ }
500
+ );
501
+ }
502
+
503
+ /**
504
+ * Operation associateIpToChildAsyncWithHttpInfo
505
+ *
506
+ * Associate a dedicated IP to the child
507
+ *
508
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
509
+ * @param \SendinBlue\Client\Model\ManageIp $ip IP to associate (required)
510
+ *
511
+ * @throws \InvalidArgumentException
512
+ * @return \GuzzleHttp\Promise\PromiseInterface
513
+ */
514
+ public function associateIpToChildAsyncWithHttpInfo($childAuthKey, $ip)
515
+ {
516
+ $returnType = '';
517
+ $request = $this->associateIpToChildRequest($childAuthKey, $ip);
518
+
519
+ return $this->client
520
+ ->sendAsync($request, $this->createHttpClientOption())
521
+ ->then(
522
+ function ($response) use ($returnType) {
523
+ return [null, $response->getStatusCode(), $response->getHeaders()];
524
+ },
525
+ function ($exception) {
526
+ $response = $exception->getResponse();
527
+ $statusCode = $response->getStatusCode();
528
+ throw new ApiException(
529
+ sprintf(
530
+ '[%d] Error connecting to the API (%s)',
531
+ $statusCode,
532
+ $exception->getRequest()->getUri()
533
+ ),
534
+ $statusCode,
535
+ $response->getHeaders(),
536
+ $response->getBody()
537
+ );
538
+ }
539
+ );
540
+ }
541
+
542
+ /**
543
+ * Create request for operation 'associateIpToChild'
544
+ *
545
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
546
+ * @param \SendinBlue\Client\Model\ManageIp $ip IP to associate (required)
547
+ *
548
+ * @throws \InvalidArgumentException
549
+ * @return \GuzzleHttp\Psr7\Request
550
+ */
551
+ protected function associateIpToChildRequest($childAuthKey, $ip)
552
+ {
553
+ // verify the required parameter 'childAuthKey' is set
554
+ if ($childAuthKey === null) {
555
+ throw new \InvalidArgumentException(
556
+ 'Missing the required parameter $childAuthKey when calling associateIpToChild'
557
+ );
558
+ }
559
+ // verify the required parameter 'ip' is set
560
+ if ($ip === null) {
561
+ throw new \InvalidArgumentException(
562
+ 'Missing the required parameter $ip when calling associateIpToChild'
563
+ );
564
+ }
565
+
566
+ $resourcePath = '/reseller/children/{childAuthKey}/ips/associate';
567
+ $formParams = [];
568
+ $queryParams = [];
569
+ $headerParams = [];
570
+ $httpBody = '';
571
+ $multipart = false;
572
+
573
+
574
+ // path params
575
+ if ($childAuthKey !== null) {
576
+ $resourcePath = str_replace(
577
+ '{' . 'childAuthKey' . '}',
578
+ ObjectSerializer::toPathValue($childAuthKey),
579
+ $resourcePath
580
+ );
581
+ }
582
+
583
+ // body params
584
+ $_tempBody = null;
585
+ if (isset($ip)) {
586
+ $_tempBody = $ip;
587
+ }
588
+
589
+ if ($multipart) {
590
+ $headers = $this->headerSelector->selectHeadersForMultipart(
591
+ ['application/json']
592
+ );
593
+ } else {
594
+ $headers = $this->headerSelector->selectHeaders(
595
+ ['application/json'],
596
+ ['application/json']
597
+ );
598
+ }
599
+
600
+ // for model (json/xml)
601
+ if (isset($_tempBody)) {
602
+ // $_tempBody is the method argument, if present
603
+ $httpBody = $_tempBody;
604
+ // \stdClass has no __toString(), so we should encode it manually
605
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
606
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
607
+ }
608
+ } elseif (count($formParams) > 0) {
609
+ if ($multipart) {
610
+ $multipartContents = [];
611
+ foreach ($formParams as $formParamName => $formParamValue) {
612
+ $multipartContents[] = [
613
+ 'name' => $formParamName,
614
+ 'contents' => $formParamValue
615
+ ];
616
+ }
617
+ // for HTTP post (form)
618
+ $httpBody = new MultipartStream($multipartContents);
619
+
620
+ } elseif ($headers['Content-Type'] === 'application/json') {
621
+ $httpBody = \GuzzleHttp\json_encode($formParams);
622
+
623
+ } else {
624
+ // for HTTP post (form)
625
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
626
+ }
627
+ }
628
+
629
+ // this endpoint requires API key authentication
630
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
631
+ if ($apiKey !== null) {
632
+ $headers['api-key'] = $apiKey;
633
+ }
634
+ // this endpoint requires API key authentication
635
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
636
+ if ($apiKey !== null) {
637
+ $headers['partner-key'] = $apiKey;
638
+ }
639
+
640
+ $defaultHeaders = [];
641
+ if ($this->config->getUserAgent()) {
642
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
643
+ }
644
+
645
+ $headers = array_merge(
646
+ $defaultHeaders,
647
+ $headerParams,
648
+ $headers
649
+ );
650
+
651
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
652
+ return new Request(
653
+ 'POST',
654
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
655
+ $headers,
656
+ $httpBody
657
+ );
658
+ }
659
+
660
+ /**
661
+ * Operation createChildDomain
662
+ *
663
+ * Creates a domain for a child account
664
+ *
665
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
666
+ * @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account (required)
667
+ *
668
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
669
+ * @throws \InvalidArgumentException
670
+ * @return void
671
+ */
672
+ public function createChildDomain($childAuthKey, $addChildDomain)
673
+ {
674
+ $this->createChildDomainWithHttpInfo($childAuthKey, $addChildDomain);
675
+ }
676
+
677
+ /**
678
+ * Operation createChildDomainWithHttpInfo
679
+ *
680
+ * Creates a domain for a child account
681
+ *
682
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
683
+ * @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account (required)
684
+ *
685
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
686
+ * @throws \InvalidArgumentException
687
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
688
+ */
689
+ public function createChildDomainWithHttpInfo($childAuthKey, $addChildDomain)
690
+ {
691
+ $returnType = '';
692
+ $request = $this->createChildDomainRequest($childAuthKey, $addChildDomain);
693
+
694
+ try {
695
+ $options = $this->createHttpClientOption();
696
+ try {
697
+ $response = $this->client->send($request, $options);
698
+ } catch (RequestException $e) {
699
+ throw new ApiException(
700
+ "[{$e->getCode()}] {$e->getMessage()}",
701
+ $e->getCode(),
702
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
703
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
704
+ );
705
+ }
706
+
707
+ $statusCode = $response->getStatusCode();
708
+
709
+ if ($statusCode < 200 || $statusCode > 299) {
710
+ throw new ApiException(
711
+ sprintf(
712
+ '[%d] Error connecting to the API (%s)',
713
+ $statusCode,
714
+ $request->getUri()
715
+ ),
716
+ $statusCode,
717
+ $response->getHeaders(),
718
+ $response->getBody()
719
+ );
720
+ }
721
+
722
+ return [null, $statusCode, $response->getHeaders()];
723
+
724
+ } catch (ApiException $e) {
725
+ switch ($e->getCode()) {
726
+ case 400:
727
+ $data = ObjectSerializer::deserialize(
728
+ $e->getResponseBody(),
729
+ '\SendinBlue\Client\Model\ErrorModel',
730
+ $e->getResponseHeaders()
731
+ );
732
+ $e->setResponseObject($data);
733
+ break;
734
+ case 403:
735
+ $data = ObjectSerializer::deserialize(
736
+ $e->getResponseBody(),
737
+ '\SendinBlue\Client\Model\ErrorModel',
738
+ $e->getResponseHeaders()
739
+ );
740
+ $e->setResponseObject($data);
741
+ break;
742
+ case 404:
743
+ $data = ObjectSerializer::deserialize(
744
+ $e->getResponseBody(),
745
+ '\SendinBlue\Client\Model\ErrorModel',
746
+ $e->getResponseHeaders()
747
+ );
748
+ $e->setResponseObject($data);
749
+ break;
750
+ }
751
+ throw $e;
752
+ }
753
+ }
754
+
755
+ /**
756
+ * Operation createChildDomainAsync
757
+ *
758
+ * Creates a domain for a child account
759
+ *
760
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
761
+ * @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account (required)
762
+ *
763
+ * @throws \InvalidArgumentException
764
+ * @return \GuzzleHttp\Promise\PromiseInterface
765
+ */
766
+ public function createChildDomainAsync($childAuthKey, $addChildDomain)
767
+ {
768
+ return $this->createChildDomainAsyncWithHttpInfo($childAuthKey, $addChildDomain)
769
+ ->then(
770
+ function ($response) {
771
+ return $response[0];
772
+ }
773
+ );
774
+ }
775
+
776
+ /**
777
+ * Operation createChildDomainAsyncWithHttpInfo
778
+ *
779
+ * Creates a domain for a child account
780
+ *
781
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
782
+ * @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account (required)
783
+ *
784
+ * @throws \InvalidArgumentException
785
+ * @return \GuzzleHttp\Promise\PromiseInterface
786
+ */
787
+ public function createChildDomainAsyncWithHttpInfo($childAuthKey, $addChildDomain)
788
+ {
789
+ $returnType = '';
790
+ $request = $this->createChildDomainRequest($childAuthKey, $addChildDomain);
791
+
792
+ return $this->client
793
+ ->sendAsync($request, $this->createHttpClientOption())
794
+ ->then(
795
+ function ($response) use ($returnType) {
796
+ return [null, $response->getStatusCode(), $response->getHeaders()];
797
+ },
798
+ function ($exception) {
799
+ $response = $exception->getResponse();
800
+ $statusCode = $response->getStatusCode();
801
+ throw new ApiException(
802
+ sprintf(
803
+ '[%d] Error connecting to the API (%s)',
804
+ $statusCode,
805
+ $exception->getRequest()->getUri()
806
+ ),
807
+ $statusCode,
808
+ $response->getHeaders(),
809
+ $response->getBody()
810
+ );
811
+ }
812
+ );
813
+ }
814
+
815
+ /**
816
+ * Create request for operation 'createChildDomain'
817
+ *
818
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
819
+ * @param \SendinBlue\Client\Model\AddChildDomain $addChildDomain Sender domain to add for a specific child account (required)
820
+ *
821
+ * @throws \InvalidArgumentException
822
+ * @return \GuzzleHttp\Psr7\Request
823
+ */
824
+ protected function createChildDomainRequest($childAuthKey, $addChildDomain)
825
+ {
826
+ // verify the required parameter 'childAuthKey' is set
827
+ if ($childAuthKey === null) {
828
+ throw new \InvalidArgumentException(
829
+ 'Missing the required parameter $childAuthKey when calling createChildDomain'
830
+ );
831
+ }
832
+ // verify the required parameter 'addChildDomain' is set
833
+ if ($addChildDomain === null) {
834
+ throw new \InvalidArgumentException(
835
+ 'Missing the required parameter $addChildDomain when calling createChildDomain'
836
+ );
837
+ }
838
+
839
+ $resourcePath = '/reseller/children/{childAuthKey}/domains';
840
+ $formParams = [];
841
+ $queryParams = [];
842
+ $headerParams = [];
843
+ $httpBody = '';
844
+ $multipart = false;
845
+
846
+
847
+ // path params
848
+ if ($childAuthKey !== null) {
849
+ $resourcePath = str_replace(
850
+ '{' . 'childAuthKey' . '}',
851
+ ObjectSerializer::toPathValue($childAuthKey),
852
+ $resourcePath
853
+ );
854
+ }
855
+
856
+ // body params
857
+ $_tempBody = null;
858
+ if (isset($addChildDomain)) {
859
+ $_tempBody = $addChildDomain;
860
+ }
861
+
862
+ if ($multipart) {
863
+ $headers = $this->headerSelector->selectHeadersForMultipart(
864
+ ['application/json']
865
+ );
866
+ } else {
867
+ $headers = $this->headerSelector->selectHeaders(
868
+ ['application/json'],
869
+ ['application/json']
870
+ );
871
+ }
872
+
873
+ // for model (json/xml)
874
+ if (isset($_tempBody)) {
875
+ // $_tempBody is the method argument, if present
876
+ $httpBody = $_tempBody;
877
+ // \stdClass has no __toString(), so we should encode it manually
878
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
879
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
880
+ }
881
+ } elseif (count($formParams) > 0) {
882
+ if ($multipart) {
883
+ $multipartContents = [];
884
+ foreach ($formParams as $formParamName => $formParamValue) {
885
+ $multipartContents[] = [
886
+ 'name' => $formParamName,
887
+ 'contents' => $formParamValue
888
+ ];
889
+ }
890
+ // for HTTP post (form)
891
+ $httpBody = new MultipartStream($multipartContents);
892
+
893
+ } elseif ($headers['Content-Type'] === 'application/json') {
894
+ $httpBody = \GuzzleHttp\json_encode($formParams);
895
+
896
+ } else {
897
+ // for HTTP post (form)
898
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
899
+ }
900
+ }
901
+
902
+ // this endpoint requires API key authentication
903
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
904
+ if ($apiKey !== null) {
905
+ $headers['api-key'] = $apiKey;
906
+ }
907
+ // this endpoint requires API key authentication
908
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
909
+ if ($apiKey !== null) {
910
+ $headers['partner-key'] = $apiKey;
911
+ }
912
+
913
+ $defaultHeaders = [];
914
+ if ($this->config->getUserAgent()) {
915
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
916
+ }
917
+
918
+ $headers = array_merge(
919
+ $defaultHeaders,
920
+ $headerParams,
921
+ $headers
922
+ );
923
+
924
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
925
+ return new Request(
926
+ 'POST',
927
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
928
+ $headers,
929
+ $httpBody
930
+ );
931
+ }
932
+
933
+ /**
934
+ * Operation createResellerChild
935
+ *
936
+ * Creates a reseller child
937
+ *
938
+ * @param \SendinBlue\Client\Model\CreateChild $resellerChild reseller child to add (optional)
939
+ *
940
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
941
+ * @throws \InvalidArgumentException
942
+ * @return \SendinBlue\Client\Model\CreateReseller
943
+ */
944
+ public function createResellerChild($resellerChild = null)
945
+ {
946
+ list($response) = $this->createResellerChildWithHttpInfo($resellerChild);
947
+ return $response;
948
+ }
949
+
950
+ /**
951
+ * Operation createResellerChildWithHttpInfo
952
+ *
953
+ * Creates a reseller child
954
+ *
955
+ * @param \SendinBlue\Client\Model\CreateChild $resellerChild reseller child to add (optional)
956
+ *
957
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
958
+ * @throws \InvalidArgumentException
959
+ * @return array of \SendinBlue\Client\Model\CreateReseller, HTTP status code, HTTP response headers (array of strings)
960
+ */
961
+ public function createResellerChildWithHttpInfo($resellerChild = null)
962
+ {
963
+ $returnType = '\SendinBlue\Client\Model\CreateReseller';
964
+ $request = $this->createResellerChildRequest($resellerChild);
965
+
966
+ try {
967
+ $options = $this->createHttpClientOption();
968
+ try {
969
+ $response = $this->client->send($request, $options);
970
+ } catch (RequestException $e) {
971
+ throw new ApiException(
972
+ "[{$e->getCode()}] {$e->getMessage()}",
973
+ $e->getCode(),
974
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
975
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
976
+ );
977
+ }
978
+
979
+ $statusCode = $response->getStatusCode();
980
+
981
+ if ($statusCode < 200 || $statusCode > 299) {
982
+ throw new ApiException(
983
+ sprintf(
984
+ '[%d] Error connecting to the API (%s)',
985
+ $statusCode,
986
+ $request->getUri()
987
+ ),
988
+ $statusCode,
989
+ $response->getHeaders(),
990
+ $response->getBody()
991
+ );
992
+ }
993
+
994
+ $responseBody = $response->getBody();
995
+ if ($returnType === '\SplFileObject') {
996
+ $content = $responseBody; //stream goes to serializer
997
+ } else {
998
+ $content = $responseBody->getContents();
999
+ if ($returnType !== 'string') {
1000
+ $content = json_decode($content);
1001
+ }
1002
+ }
1003
+
1004
+ return [
1005
+ ObjectSerializer::deserialize($content, $returnType, []),
1006
+ $response->getStatusCode(),
1007
+ $response->getHeaders()
1008
+ ];
1009
+
1010
+ } catch (ApiException $e) {
1011
+ switch ($e->getCode()) {
1012
+ case 201:
1013
+ $data = ObjectSerializer::deserialize(
1014
+ $e->getResponseBody(),
1015
+ '\SendinBlue\Client\Model\CreateReseller',
1016
+ $e->getResponseHeaders()
1017
+ );
1018
+ $e->setResponseObject($data);
1019
+ break;
1020
+ case 400:
1021
+ $data = ObjectSerializer::deserialize(
1022
+ $e->getResponseBody(),
1023
+ '\SendinBlue\Client\Model\ErrorModel',
1024
+ $e->getResponseHeaders()
1025
+ );
1026
+ $e->setResponseObject($data);
1027
+ break;
1028
+ case 403:
1029
+ $data = ObjectSerializer::deserialize(
1030
+ $e->getResponseBody(),
1031
+ '\SendinBlue\Client\Model\ErrorModel',
1032
+ $e->getResponseHeaders()
1033
+ );
1034
+ $e->setResponseObject($data);
1035
+ break;
1036
+ }
1037
+ throw $e;
1038
+ }
1039
+ }
1040
+
1041
+ /**
1042
+ * Operation createResellerChildAsync
1043
+ *
1044
+ * Creates a reseller child
1045
+ *
1046
+ * @param \SendinBlue\Client\Model\CreateChild $resellerChild reseller child to add (optional)
1047
+ *
1048
+ * @throws \InvalidArgumentException
1049
+ * @return \GuzzleHttp\Promise\PromiseInterface
1050
+ */
1051
+ public function createResellerChildAsync($resellerChild = null)
1052
+ {
1053
+ return $this->createResellerChildAsyncWithHttpInfo($resellerChild)
1054
+ ->then(
1055
+ function ($response) {
1056
+ return $response[0];
1057
+ }
1058
+ );
1059
+ }
1060
+
1061
+ /**
1062
+ * Operation createResellerChildAsyncWithHttpInfo
1063
+ *
1064
+ * Creates a reseller child
1065
+ *
1066
+ * @param \SendinBlue\Client\Model\CreateChild $resellerChild reseller child to add (optional)
1067
+ *
1068
+ * @throws \InvalidArgumentException
1069
+ * @return \GuzzleHttp\Promise\PromiseInterface
1070
+ */
1071
+ public function createResellerChildAsyncWithHttpInfo($resellerChild = null)
1072
+ {
1073
+ $returnType = '\SendinBlue\Client\Model\CreateReseller';
1074
+ $request = $this->createResellerChildRequest($resellerChild);
1075
+
1076
+ return $this->client
1077
+ ->sendAsync($request, $this->createHttpClientOption())
1078
+ ->then(
1079
+ function ($response) use ($returnType) {
1080
+ $responseBody = $response->getBody();
1081
+ if ($returnType === '\SplFileObject') {
1082
+ $content = $responseBody; //stream goes to serializer
1083
+ } else {
1084
+ $content = $responseBody->getContents();
1085
+ if ($returnType !== 'string') {
1086
+ $content = json_decode($content);
1087
+ }
1088
+ }
1089
+
1090
+ return [
1091
+ ObjectSerializer::deserialize($content, $returnType, []),
1092
+ $response->getStatusCode(),
1093
+ $response->getHeaders()
1094
+ ];
1095
+ },
1096
+ function ($exception) {
1097
+ $response = $exception->getResponse();
1098
+ $statusCode = $response->getStatusCode();
1099
+ throw new ApiException(
1100
+ sprintf(
1101
+ '[%d] Error connecting to the API (%s)',
1102
+ $statusCode,
1103
+ $exception->getRequest()->getUri()
1104
+ ),
1105
+ $statusCode,
1106
+ $response->getHeaders(),
1107
+ $response->getBody()
1108
+ );
1109
+ }
1110
+ );
1111
+ }
1112
+
1113
+ /**
1114
+ * Create request for operation 'createResellerChild'
1115
+ *
1116
+ * @param \SendinBlue\Client\Model\CreateChild $resellerChild reseller child to add (optional)
1117
+ *
1118
+ * @throws \InvalidArgumentException
1119
+ * @return \GuzzleHttp\Psr7\Request
1120
+ */
1121
+ protected function createResellerChildRequest($resellerChild = null)
1122
+ {
1123
+
1124
+ $resourcePath = '/reseller/children';
1125
+ $formParams = [];
1126
+ $queryParams = [];
1127
+ $headerParams = [];
1128
+ $httpBody = '';
1129
+ $multipart = false;
1130
+
1131
+
1132
+
1133
+ // body params
1134
+ $_tempBody = null;
1135
+ if (isset($resellerChild)) {
1136
+ $_tempBody = $resellerChild;
1137
+ }
1138
+
1139
+ if ($multipart) {
1140
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1141
+ ['application/json']
1142
+ );
1143
+ } else {
1144
+ $headers = $this->headerSelector->selectHeaders(
1145
+ ['application/json'],
1146
+ ['application/json']
1147
+ );
1148
+ }
1149
+
1150
+ // for model (json/xml)
1151
+ if (isset($_tempBody)) {
1152
+ // $_tempBody is the method argument, if present
1153
+ $httpBody = $_tempBody;
1154
+ // \stdClass has no __toString(), so we should encode it manually
1155
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1156
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1157
+ }
1158
+ } elseif (count($formParams) > 0) {
1159
+ if ($multipart) {
1160
+ $multipartContents = [];
1161
+ foreach ($formParams as $formParamName => $formParamValue) {
1162
+ $multipartContents[] = [
1163
+ 'name' => $formParamName,
1164
+ 'contents' => $formParamValue
1165
+ ];
1166
+ }
1167
+ // for HTTP post (form)
1168
+ $httpBody = new MultipartStream($multipartContents);
1169
+
1170
+ } elseif ($headers['Content-Type'] === 'application/json') {
1171
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1172
+
1173
+ } else {
1174
+ // for HTTP post (form)
1175
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1176
+ }
1177
+ }
1178
+
1179
+ // this endpoint requires API key authentication
1180
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1181
+ if ($apiKey !== null) {
1182
+ $headers['api-key'] = $apiKey;
1183
+ }
1184
+ // this endpoint requires API key authentication
1185
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1186
+ if ($apiKey !== null) {
1187
+ $headers['partner-key'] = $apiKey;
1188
+ }
1189
+
1190
+ $defaultHeaders = [];
1191
+ if ($this->config->getUserAgent()) {
1192
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1193
+ }
1194
+
1195
+ $headers = array_merge(
1196
+ $defaultHeaders,
1197
+ $headerParams,
1198
+ $headers
1199
+ );
1200
+
1201
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1202
+ return new Request(
1203
+ 'POST',
1204
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1205
+ $headers,
1206
+ $httpBody
1207
+ );
1208
+ }
1209
+
1210
+ /**
1211
+ * Operation deleteChildDomain
1212
+ *
1213
+ * Deletes the sender domain of the reseller child based on the childAuthKey and domainName passed
1214
+ *
1215
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1216
+ * @param string $domainName Pass the existing domain that needs to be deleted (required)
1217
+ *
1218
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1219
+ * @throws \InvalidArgumentException
1220
+ * @return void
1221
+ */
1222
+ public function deleteChildDomain($childAuthKey, $domainName)
1223
+ {
1224
+ $this->deleteChildDomainWithHttpInfo($childAuthKey, $domainName);
1225
+ }
1226
+
1227
+ /**
1228
+ * Operation deleteChildDomainWithHttpInfo
1229
+ *
1230
+ * Deletes the sender domain of the reseller child based on the childAuthKey and domainName passed
1231
+ *
1232
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1233
+ * @param string $domainName Pass the existing domain that needs to be deleted (required)
1234
+ *
1235
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1236
+ * @throws \InvalidArgumentException
1237
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
1238
+ */
1239
+ public function deleteChildDomainWithHttpInfo($childAuthKey, $domainName)
1240
+ {
1241
+ $returnType = '';
1242
+ $request = $this->deleteChildDomainRequest($childAuthKey, $domainName);
1243
+
1244
+ try {
1245
+ $options = $this->createHttpClientOption();
1246
+ try {
1247
+ $response = $this->client->send($request, $options);
1248
+ } catch (RequestException $e) {
1249
+ throw new ApiException(
1250
+ "[{$e->getCode()}] {$e->getMessage()}",
1251
+ $e->getCode(),
1252
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1253
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1254
+ );
1255
+ }
1256
+
1257
+ $statusCode = $response->getStatusCode();
1258
+
1259
+ if ($statusCode < 200 || $statusCode > 299) {
1260
+ throw new ApiException(
1261
+ sprintf(
1262
+ '[%d] Error connecting to the API (%s)',
1263
+ $statusCode,
1264
+ $request->getUri()
1265
+ ),
1266
+ $statusCode,
1267
+ $response->getHeaders(),
1268
+ $response->getBody()
1269
+ );
1270
+ }
1271
+
1272
+ return [null, $statusCode, $response->getHeaders()];
1273
+
1274
+ } catch (ApiException $e) {
1275
+ switch ($e->getCode()) {
1276
+ case 400:
1277
+ $data = ObjectSerializer::deserialize(
1278
+ $e->getResponseBody(),
1279
+ '\SendinBlue\Client\Model\ErrorModel',
1280
+ $e->getResponseHeaders()
1281
+ );
1282
+ $e->setResponseObject($data);
1283
+ break;
1284
+ case 403:
1285
+ $data = ObjectSerializer::deserialize(
1286
+ $e->getResponseBody(),
1287
+ '\SendinBlue\Client\Model\ErrorModel',
1288
+ $e->getResponseHeaders()
1289
+ );
1290
+ $e->setResponseObject($data);
1291
+ break;
1292
+ case 404:
1293
+ $data = ObjectSerializer::deserialize(
1294
+ $e->getResponseBody(),
1295
+ '\SendinBlue\Client\Model\ErrorModel',
1296
+ $e->getResponseHeaders()
1297
+ );
1298
+ $e->setResponseObject($data);
1299
+ break;
1300
+ }
1301
+ throw $e;
1302
+ }
1303
+ }
1304
+
1305
+ /**
1306
+ * Operation deleteChildDomainAsync
1307
+ *
1308
+ * Deletes the sender domain of the reseller child based on the childAuthKey and domainName passed
1309
+ *
1310
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1311
+ * @param string $domainName Pass the existing domain that needs to be deleted (required)
1312
+ *
1313
+ * @throws \InvalidArgumentException
1314
+ * @return \GuzzleHttp\Promise\PromiseInterface
1315
+ */
1316
+ public function deleteChildDomainAsync($childAuthKey, $domainName)
1317
+ {
1318
+ return $this->deleteChildDomainAsyncWithHttpInfo($childAuthKey, $domainName)
1319
+ ->then(
1320
+ function ($response) {
1321
+ return $response[0];
1322
+ }
1323
+ );
1324
+ }
1325
+
1326
+ /**
1327
+ * Operation deleteChildDomainAsyncWithHttpInfo
1328
+ *
1329
+ * Deletes the sender domain of the reseller child based on the childAuthKey and domainName passed
1330
+ *
1331
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1332
+ * @param string $domainName Pass the existing domain that needs to be deleted (required)
1333
+ *
1334
+ * @throws \InvalidArgumentException
1335
+ * @return \GuzzleHttp\Promise\PromiseInterface
1336
+ */
1337
+ public function deleteChildDomainAsyncWithHttpInfo($childAuthKey, $domainName)
1338
+ {
1339
+ $returnType = '';
1340
+ $request = $this->deleteChildDomainRequest($childAuthKey, $domainName);
1341
+
1342
+ return $this->client
1343
+ ->sendAsync($request, $this->createHttpClientOption())
1344
+ ->then(
1345
+ function ($response) use ($returnType) {
1346
+ return [null, $response->getStatusCode(), $response->getHeaders()];
1347
+ },
1348
+ function ($exception) {
1349
+ $response = $exception->getResponse();
1350
+ $statusCode = $response->getStatusCode();
1351
+ throw new ApiException(
1352
+ sprintf(
1353
+ '[%d] Error connecting to the API (%s)',
1354
+ $statusCode,
1355
+ $exception->getRequest()->getUri()
1356
+ ),
1357
+ $statusCode,
1358
+ $response->getHeaders(),
1359
+ $response->getBody()
1360
+ );
1361
+ }
1362
+ );
1363
+ }
1364
+
1365
+ /**
1366
+ * Create request for operation 'deleteChildDomain'
1367
+ *
1368
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1369
+ * @param string $domainName Pass the existing domain that needs to be deleted (required)
1370
+ *
1371
+ * @throws \InvalidArgumentException
1372
+ * @return \GuzzleHttp\Psr7\Request
1373
+ */
1374
+ protected function deleteChildDomainRequest($childAuthKey, $domainName)
1375
+ {
1376
+ // verify the required parameter 'childAuthKey' is set
1377
+ if ($childAuthKey === null) {
1378
+ throw new \InvalidArgumentException(
1379
+ 'Missing the required parameter $childAuthKey when calling deleteChildDomain'
1380
+ );
1381
+ }
1382
+ // verify the required parameter 'domainName' is set
1383
+ if ($domainName === null) {
1384
+ throw new \InvalidArgumentException(
1385
+ 'Missing the required parameter $domainName when calling deleteChildDomain'
1386
+ );
1387
+ }
1388
+
1389
+ $resourcePath = '/reseller/children/{childAuthKey}/domains/{domainName}';
1390
+ $formParams = [];
1391
+ $queryParams = [];
1392
+ $headerParams = [];
1393
+ $httpBody = '';
1394
+ $multipart = false;
1395
+
1396
+
1397
+ // path params
1398
+ if ($childAuthKey !== null) {
1399
+ $resourcePath = str_replace(
1400
+ '{' . 'childAuthKey' . '}',
1401
+ ObjectSerializer::toPathValue($childAuthKey),
1402
+ $resourcePath
1403
+ );
1404
+ }
1405
+ // path params
1406
+ if ($domainName !== null) {
1407
+ $resourcePath = str_replace(
1408
+ '{' . 'domainName' . '}',
1409
+ ObjectSerializer::toPathValue($domainName),
1410
+ $resourcePath
1411
+ );
1412
+ }
1413
+
1414
+ // body params
1415
+ $_tempBody = null;
1416
+
1417
+ if ($multipart) {
1418
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1419
+ ['application/json']
1420
+ );
1421
+ } else {
1422
+ $headers = $this->headerSelector->selectHeaders(
1423
+ ['application/json'],
1424
+ ['application/json']
1425
+ );
1426
+ }
1427
+
1428
+ // for model (json/xml)
1429
+ if (isset($_tempBody)) {
1430
+ // $_tempBody is the method argument, if present
1431
+ $httpBody = $_tempBody;
1432
+ // \stdClass has no __toString(), so we should encode it manually
1433
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1434
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1435
+ }
1436
+ } elseif (count($formParams) > 0) {
1437
+ if ($multipart) {
1438
+ $multipartContents = [];
1439
+ foreach ($formParams as $formParamName => $formParamValue) {
1440
+ $multipartContents[] = [
1441
+ 'name' => $formParamName,
1442
+ 'contents' => $formParamValue
1443
+ ];
1444
+ }
1445
+ // for HTTP post (form)
1446
+ $httpBody = new MultipartStream($multipartContents);
1447
+
1448
+ } elseif ($headers['Content-Type'] === 'application/json') {
1449
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1450
+
1451
+ } else {
1452
+ // for HTTP post (form)
1453
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1454
+ }
1455
+ }
1456
+
1457
+ // this endpoint requires API key authentication
1458
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1459
+ if ($apiKey !== null) {
1460
+ $headers['api-key'] = $apiKey;
1461
+ }
1462
+ // this endpoint requires API key authentication
1463
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1464
+ if ($apiKey !== null) {
1465
+ $headers['partner-key'] = $apiKey;
1466
+ }
1467
+
1468
+ $defaultHeaders = [];
1469
+ if ($this->config->getUserAgent()) {
1470
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1471
+ }
1472
+
1473
+ $headers = array_merge(
1474
+ $defaultHeaders,
1475
+ $headerParams,
1476
+ $headers
1477
+ );
1478
+
1479
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1480
+ return new Request(
1481
+ 'DELETE',
1482
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1483
+ $headers,
1484
+ $httpBody
1485
+ );
1486
+ }
1487
+
1488
+ /**
1489
+ * Operation deleteResellerChild
1490
+ *
1491
+ * Deletes a single reseller child based on the childAuthKey supplied
1492
+ *
1493
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1494
+ *
1495
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1496
+ * @throws \InvalidArgumentException
1497
+ * @return void
1498
+ */
1499
+ public function deleteResellerChild($childAuthKey)
1500
+ {
1501
+ $this->deleteResellerChildWithHttpInfo($childAuthKey);
1502
+ }
1503
+
1504
+ /**
1505
+ * Operation deleteResellerChildWithHttpInfo
1506
+ *
1507
+ * Deletes a single reseller child based on the childAuthKey supplied
1508
+ *
1509
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1510
+ *
1511
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1512
+ * @throws \InvalidArgumentException
1513
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
1514
+ */
1515
+ public function deleteResellerChildWithHttpInfo($childAuthKey)
1516
+ {
1517
+ $returnType = '';
1518
+ $request = $this->deleteResellerChildRequest($childAuthKey);
1519
+
1520
+ try {
1521
+ $options = $this->createHttpClientOption();
1522
+ try {
1523
+ $response = $this->client->send($request, $options);
1524
+ } catch (RequestException $e) {
1525
+ throw new ApiException(
1526
+ "[{$e->getCode()}] {$e->getMessage()}",
1527
+ $e->getCode(),
1528
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1529
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1530
+ );
1531
+ }
1532
+
1533
+ $statusCode = $response->getStatusCode();
1534
+
1535
+ if ($statusCode < 200 || $statusCode > 299) {
1536
+ throw new ApiException(
1537
+ sprintf(
1538
+ '[%d] Error connecting to the API (%s)',
1539
+ $statusCode,
1540
+ $request->getUri()
1541
+ ),
1542
+ $statusCode,
1543
+ $response->getHeaders(),
1544
+ $response->getBody()
1545
+ );
1546
+ }
1547
+
1548
+ return [null, $statusCode, $response->getHeaders()];
1549
+
1550
+ } catch (ApiException $e) {
1551
+ switch ($e->getCode()) {
1552
+ case 400:
1553
+ $data = ObjectSerializer::deserialize(
1554
+ $e->getResponseBody(),
1555
+ '\SendinBlue\Client\Model\ErrorModel',
1556
+ $e->getResponseHeaders()
1557
+ );
1558
+ $e->setResponseObject($data);
1559
+ break;
1560
+ case 403:
1561
+ $data = ObjectSerializer::deserialize(
1562
+ $e->getResponseBody(),
1563
+ '\SendinBlue\Client\Model\ErrorModel',
1564
+ $e->getResponseHeaders()
1565
+ );
1566
+ $e->setResponseObject($data);
1567
+ break;
1568
+ case 404:
1569
+ $data = ObjectSerializer::deserialize(
1570
+ $e->getResponseBody(),
1571
+ '\SendinBlue\Client\Model\ErrorModel',
1572
+ $e->getResponseHeaders()
1573
+ );
1574
+ $e->setResponseObject($data);
1575
+ break;
1576
+ }
1577
+ throw $e;
1578
+ }
1579
+ }
1580
+
1581
+ /**
1582
+ * Operation deleteResellerChildAsync
1583
+ *
1584
+ * Deletes a single reseller child based on the childAuthKey supplied
1585
+ *
1586
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1587
+ *
1588
+ * @throws \InvalidArgumentException
1589
+ * @return \GuzzleHttp\Promise\PromiseInterface
1590
+ */
1591
+ public function deleteResellerChildAsync($childAuthKey)
1592
+ {
1593
+ return $this->deleteResellerChildAsyncWithHttpInfo($childAuthKey)
1594
+ ->then(
1595
+ function ($response) {
1596
+ return $response[0];
1597
+ }
1598
+ );
1599
+ }
1600
+
1601
+ /**
1602
+ * Operation deleteResellerChildAsyncWithHttpInfo
1603
+ *
1604
+ * Deletes a single reseller child based on the childAuthKey supplied
1605
+ *
1606
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1607
+ *
1608
+ * @throws \InvalidArgumentException
1609
+ * @return \GuzzleHttp\Promise\PromiseInterface
1610
+ */
1611
+ public function deleteResellerChildAsyncWithHttpInfo($childAuthKey)
1612
+ {
1613
+ $returnType = '';
1614
+ $request = $this->deleteResellerChildRequest($childAuthKey);
1615
+
1616
+ return $this->client
1617
+ ->sendAsync($request, $this->createHttpClientOption())
1618
+ ->then(
1619
+ function ($response) use ($returnType) {
1620
+ return [null, $response->getStatusCode(), $response->getHeaders()];
1621
+ },
1622
+ function ($exception) {
1623
+ $response = $exception->getResponse();
1624
+ $statusCode = $response->getStatusCode();
1625
+ throw new ApiException(
1626
+ sprintf(
1627
+ '[%d] Error connecting to the API (%s)',
1628
+ $statusCode,
1629
+ $exception->getRequest()->getUri()
1630
+ ),
1631
+ $statusCode,
1632
+ $response->getHeaders(),
1633
+ $response->getBody()
1634
+ );
1635
+ }
1636
+ );
1637
+ }
1638
+
1639
+ /**
1640
+ * Create request for operation 'deleteResellerChild'
1641
+ *
1642
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1643
+ *
1644
+ * @throws \InvalidArgumentException
1645
+ * @return \GuzzleHttp\Psr7\Request
1646
+ */
1647
+ protected function deleteResellerChildRequest($childAuthKey)
1648
+ {
1649
+ // verify the required parameter 'childAuthKey' is set
1650
+ if ($childAuthKey === null) {
1651
+ throw new \InvalidArgumentException(
1652
+ 'Missing the required parameter $childAuthKey when calling deleteResellerChild'
1653
+ );
1654
+ }
1655
+
1656
+ $resourcePath = '/reseller/children/{childAuthKey}';
1657
+ $formParams = [];
1658
+ $queryParams = [];
1659
+ $headerParams = [];
1660
+ $httpBody = '';
1661
+ $multipart = false;
1662
+
1663
+
1664
+ // path params
1665
+ if ($childAuthKey !== null) {
1666
+ $resourcePath = str_replace(
1667
+ '{' . 'childAuthKey' . '}',
1668
+ ObjectSerializer::toPathValue($childAuthKey),
1669
+ $resourcePath
1670
+ );
1671
+ }
1672
+
1673
+ // body params
1674
+ $_tempBody = null;
1675
+
1676
+ if ($multipart) {
1677
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1678
+ ['application/json']
1679
+ );
1680
+ } else {
1681
+ $headers = $this->headerSelector->selectHeaders(
1682
+ ['application/json'],
1683
+ ['application/json']
1684
+ );
1685
+ }
1686
+
1687
+ // for model (json/xml)
1688
+ if (isset($_tempBody)) {
1689
+ // $_tempBody is the method argument, if present
1690
+ $httpBody = $_tempBody;
1691
+ // \stdClass has no __toString(), so we should encode it manually
1692
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1693
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1694
+ }
1695
+ } elseif (count($formParams) > 0) {
1696
+ if ($multipart) {
1697
+ $multipartContents = [];
1698
+ foreach ($formParams as $formParamName => $formParamValue) {
1699
+ $multipartContents[] = [
1700
+ 'name' => $formParamName,
1701
+ 'contents' => $formParamValue
1702
+ ];
1703
+ }
1704
+ // for HTTP post (form)
1705
+ $httpBody = new MultipartStream($multipartContents);
1706
+
1707
+ } elseif ($headers['Content-Type'] === 'application/json') {
1708
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1709
+
1710
+ } else {
1711
+ // for HTTP post (form)
1712
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1713
+ }
1714
+ }
1715
+
1716
+ // this endpoint requires API key authentication
1717
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1718
+ if ($apiKey !== null) {
1719
+ $headers['api-key'] = $apiKey;
1720
+ }
1721
+ // this endpoint requires API key authentication
1722
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1723
+ if ($apiKey !== null) {
1724
+ $headers['partner-key'] = $apiKey;
1725
+ }
1726
+
1727
+ $defaultHeaders = [];
1728
+ if ($this->config->getUserAgent()) {
1729
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1730
+ }
1731
+
1732
+ $headers = array_merge(
1733
+ $defaultHeaders,
1734
+ $headerParams,
1735
+ $headers
1736
+ );
1737
+
1738
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1739
+ return new Request(
1740
+ 'DELETE',
1741
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1742
+ $headers,
1743
+ $httpBody
1744
+ );
1745
+ }
1746
+
1747
+ /**
1748
+ * Operation dissociateIpFromChild
1749
+ *
1750
+ * Dissociate a dedicated IP to the child
1751
+ *
1752
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1753
+ * @param \SendinBlue\Client\Model\ManageIp $ip IP to dissociate (required)
1754
+ *
1755
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1756
+ * @throws \InvalidArgumentException
1757
+ * @return void
1758
+ */
1759
+ public function dissociateIpFromChild($childAuthKey, $ip)
1760
+ {
1761
+ $this->dissociateIpFromChildWithHttpInfo($childAuthKey, $ip);
1762
+ }
1763
+
1764
+ /**
1765
+ * Operation dissociateIpFromChildWithHttpInfo
1766
+ *
1767
+ * Dissociate a dedicated IP to the child
1768
+ *
1769
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1770
+ * @param \SendinBlue\Client\Model\ManageIp $ip IP to dissociate (required)
1771
+ *
1772
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1773
+ * @throws \InvalidArgumentException
1774
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
1775
+ */
1776
+ public function dissociateIpFromChildWithHttpInfo($childAuthKey, $ip)
1777
+ {
1778
+ $returnType = '';
1779
+ $request = $this->dissociateIpFromChildRequest($childAuthKey, $ip);
1780
+
1781
+ try {
1782
+ $options = $this->createHttpClientOption();
1783
+ try {
1784
+ $response = $this->client->send($request, $options);
1785
+ } catch (RequestException $e) {
1786
+ throw new ApiException(
1787
+ "[{$e->getCode()}] {$e->getMessage()}",
1788
+ $e->getCode(),
1789
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1790
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1791
+ );
1792
+ }
1793
+
1794
+ $statusCode = $response->getStatusCode();
1795
+
1796
+ if ($statusCode < 200 || $statusCode > 299) {
1797
+ throw new ApiException(
1798
+ sprintf(
1799
+ '[%d] Error connecting to the API (%s)',
1800
+ $statusCode,
1801
+ $request->getUri()
1802
+ ),
1803
+ $statusCode,
1804
+ $response->getHeaders(),
1805
+ $response->getBody()
1806
+ );
1807
+ }
1808
+
1809
+ return [null, $statusCode, $response->getHeaders()];
1810
+
1811
+ } catch (ApiException $e) {
1812
+ switch ($e->getCode()) {
1813
+ case 400:
1814
+ $data = ObjectSerializer::deserialize(
1815
+ $e->getResponseBody(),
1816
+ '\SendinBlue\Client\Model\ErrorModel',
1817
+ $e->getResponseHeaders()
1818
+ );
1819
+ $e->setResponseObject($data);
1820
+ break;
1821
+ case 404:
1822
+ $data = ObjectSerializer::deserialize(
1823
+ $e->getResponseBody(),
1824
+ '\SendinBlue\Client\Model\ErrorModel',
1825
+ $e->getResponseHeaders()
1826
+ );
1827
+ $e->setResponseObject($data);
1828
+ break;
1829
+ }
1830
+ throw $e;
1831
+ }
1832
+ }
1833
+
1834
+ /**
1835
+ * Operation dissociateIpFromChildAsync
1836
+ *
1837
+ * Dissociate a dedicated IP to the child
1838
+ *
1839
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1840
+ * @param \SendinBlue\Client\Model\ManageIp $ip IP to dissociate (required)
1841
+ *
1842
+ * @throws \InvalidArgumentException
1843
+ * @return \GuzzleHttp\Promise\PromiseInterface
1844
+ */
1845
+ public function dissociateIpFromChildAsync($childAuthKey, $ip)
1846
+ {
1847
+ return $this->dissociateIpFromChildAsyncWithHttpInfo($childAuthKey, $ip)
1848
+ ->then(
1849
+ function ($response) {
1850
+ return $response[0];
1851
+ }
1852
+ );
1853
+ }
1854
+
1855
+ /**
1856
+ * Operation dissociateIpFromChildAsyncWithHttpInfo
1857
+ *
1858
+ * Dissociate a dedicated IP to the child
1859
+ *
1860
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1861
+ * @param \SendinBlue\Client\Model\ManageIp $ip IP to dissociate (required)
1862
+ *
1863
+ * @throws \InvalidArgumentException
1864
+ * @return \GuzzleHttp\Promise\PromiseInterface
1865
+ */
1866
+ public function dissociateIpFromChildAsyncWithHttpInfo($childAuthKey, $ip)
1867
+ {
1868
+ $returnType = '';
1869
+ $request = $this->dissociateIpFromChildRequest($childAuthKey, $ip);
1870
+
1871
+ return $this->client
1872
+ ->sendAsync($request, $this->createHttpClientOption())
1873
+ ->then(
1874
+ function ($response) use ($returnType) {
1875
+ return [null, $response->getStatusCode(), $response->getHeaders()];
1876
+ },
1877
+ function ($exception) {
1878
+ $response = $exception->getResponse();
1879
+ $statusCode = $response->getStatusCode();
1880
+ throw new ApiException(
1881
+ sprintf(
1882
+ '[%d] Error connecting to the API (%s)',
1883
+ $statusCode,
1884
+ $exception->getRequest()->getUri()
1885
+ ),
1886
+ $statusCode,
1887
+ $response->getHeaders(),
1888
+ $response->getBody()
1889
+ );
1890
+ }
1891
+ );
1892
+ }
1893
+
1894
+ /**
1895
+ * Create request for operation 'dissociateIpFromChild'
1896
+ *
1897
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
1898
+ * @param \SendinBlue\Client\Model\ManageIp $ip IP to dissociate (required)
1899
+ *
1900
+ * @throws \InvalidArgumentException
1901
+ * @return \GuzzleHttp\Psr7\Request
1902
+ */
1903
+ protected function dissociateIpFromChildRequest($childAuthKey, $ip)
1904
+ {
1905
+ // verify the required parameter 'childAuthKey' is set
1906
+ if ($childAuthKey === null) {
1907
+ throw new \InvalidArgumentException(
1908
+ 'Missing the required parameter $childAuthKey when calling dissociateIpFromChild'
1909
+ );
1910
+ }
1911
+ // verify the required parameter 'ip' is set
1912
+ if ($ip === null) {
1913
+ throw new \InvalidArgumentException(
1914
+ 'Missing the required parameter $ip when calling dissociateIpFromChild'
1915
+ );
1916
+ }
1917
+
1918
+ $resourcePath = '/reseller/children/{childAuthKey}/ips/dissociate';
1919
+ $formParams = [];
1920
+ $queryParams = [];
1921
+ $headerParams = [];
1922
+ $httpBody = '';
1923
+ $multipart = false;
1924
+
1925
+
1926
+ // path params
1927
+ if ($childAuthKey !== null) {
1928
+ $resourcePath = str_replace(
1929
+ '{' . 'childAuthKey' . '}',
1930
+ ObjectSerializer::toPathValue($childAuthKey),
1931
+ $resourcePath
1932
+ );
1933
+ }
1934
+
1935
+ // body params
1936
+ $_tempBody = null;
1937
+ if (isset($ip)) {
1938
+ $_tempBody = $ip;
1939
+ }
1940
+
1941
+ if ($multipart) {
1942
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1943
+ ['application/json']
1944
+ );
1945
+ } else {
1946
+ $headers = $this->headerSelector->selectHeaders(
1947
+ ['application/json'],
1948
+ ['application/json']
1949
+ );
1950
+ }
1951
+
1952
+ // for model (json/xml)
1953
+ if (isset($_tempBody)) {
1954
+ // $_tempBody is the method argument, if present
1955
+ $httpBody = $_tempBody;
1956
+ // \stdClass has no __toString(), so we should encode it manually
1957
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1958
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1959
+ }
1960
+ } elseif (count($formParams) > 0) {
1961
+ if ($multipart) {
1962
+ $multipartContents = [];
1963
+ foreach ($formParams as $formParamName => $formParamValue) {
1964
+ $multipartContents[] = [
1965
+ 'name' => $formParamName,
1966
+ 'contents' => $formParamValue
1967
+ ];
1968
+ }
1969
+ // for HTTP post (form)
1970
+ $httpBody = new MultipartStream($multipartContents);
1971
+
1972
+ } elseif ($headers['Content-Type'] === 'application/json') {
1973
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1974
+
1975
+ } else {
1976
+ // for HTTP post (form)
1977
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1978
+ }
1979
+ }
1980
+
1981
+ // this endpoint requires API key authentication
1982
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1983
+ if ($apiKey !== null) {
1984
+ $headers['api-key'] = $apiKey;
1985
+ }
1986
+ // this endpoint requires API key authentication
1987
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1988
+ if ($apiKey !== null) {
1989
+ $headers['partner-key'] = $apiKey;
1990
+ }
1991
+
1992
+ $defaultHeaders = [];
1993
+ if ($this->config->getUserAgent()) {
1994
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1995
+ }
1996
+
1997
+ $headers = array_merge(
1998
+ $defaultHeaders,
1999
+ $headerParams,
2000
+ $headers
2001
+ );
2002
+
2003
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2004
+ return new Request(
2005
+ 'POST',
2006
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2007
+ $headers,
2008
+ $httpBody
2009
+ );
2010
+ }
2011
+
2012
+ /**
2013
+ * Operation getChildDomains
2014
+ *
2015
+ * Gets all the sender domains of a specific child account
2016
+ *
2017
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2018
+ *
2019
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2020
+ * @throws \InvalidArgumentException
2021
+ * @return \SendinBlue\Client\Model\GetChildDomains
2022
+ */
2023
+ public function getChildDomains($childAuthKey)
2024
+ {
2025
+ list($response) = $this->getChildDomainsWithHttpInfo($childAuthKey);
2026
+ return $response;
2027
+ }
2028
+
2029
+ /**
2030
+ * Operation getChildDomainsWithHttpInfo
2031
+ *
2032
+ * Gets all the sender domains of a specific child account
2033
+ *
2034
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2035
+ *
2036
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2037
+ * @throws \InvalidArgumentException
2038
+ * @return array of \SendinBlue\Client\Model\GetChildDomains, HTTP status code, HTTP response headers (array of strings)
2039
+ */
2040
+ public function getChildDomainsWithHttpInfo($childAuthKey)
2041
+ {
2042
+ $returnType = '\SendinBlue\Client\Model\GetChildDomains';
2043
+ $request = $this->getChildDomainsRequest($childAuthKey);
2044
+
2045
+ try {
2046
+ $options = $this->createHttpClientOption();
2047
+ try {
2048
+ $response = $this->client->send($request, $options);
2049
+ } catch (RequestException $e) {
2050
+ throw new ApiException(
2051
+ "[{$e->getCode()}] {$e->getMessage()}",
2052
+ $e->getCode(),
2053
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2054
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2055
+ );
2056
+ }
2057
+
2058
+ $statusCode = $response->getStatusCode();
2059
+
2060
+ if ($statusCode < 200 || $statusCode > 299) {
2061
+ throw new ApiException(
2062
+ sprintf(
2063
+ '[%d] Error connecting to the API (%s)',
2064
+ $statusCode,
2065
+ $request->getUri()
2066
+ ),
2067
+ $statusCode,
2068
+ $response->getHeaders(),
2069
+ $response->getBody()
2070
+ );
2071
+ }
2072
+
2073
+ $responseBody = $response->getBody();
2074
+ if ($returnType === '\SplFileObject') {
2075
+ $content = $responseBody; //stream goes to serializer
2076
+ } else {
2077
+ $content = $responseBody->getContents();
2078
+ if ($returnType !== 'string') {
2079
+ $content = json_decode($content);
2080
+ }
2081
+ }
2082
+
2083
+ return [
2084
+ ObjectSerializer::deserialize($content, $returnType, []),
2085
+ $response->getStatusCode(),
2086
+ $response->getHeaders()
2087
+ ];
2088
+
2089
+ } catch (ApiException $e) {
2090
+ switch ($e->getCode()) {
2091
+ case 200:
2092
+ $data = ObjectSerializer::deserialize(
2093
+ $e->getResponseBody(),
2094
+ '\SendinBlue\Client\Model\GetChildDomains',
2095
+ $e->getResponseHeaders()
2096
+ );
2097
+ $e->setResponseObject($data);
2098
+ break;
2099
+ case 400:
2100
+ $data = ObjectSerializer::deserialize(
2101
+ $e->getResponseBody(),
2102
+ '\SendinBlue\Client\Model\ErrorModel',
2103
+ $e->getResponseHeaders()
2104
+ );
2105
+ $e->setResponseObject($data);
2106
+ break;
2107
+ case 403:
2108
+ $data = ObjectSerializer::deserialize(
2109
+ $e->getResponseBody(),
2110
+ '\SendinBlue\Client\Model\ErrorModel',
2111
+ $e->getResponseHeaders()
2112
+ );
2113
+ $e->setResponseObject($data);
2114
+ break;
2115
+ case 404:
2116
+ $data = ObjectSerializer::deserialize(
2117
+ $e->getResponseBody(),
2118
+ '\SendinBlue\Client\Model\ErrorModel',
2119
+ $e->getResponseHeaders()
2120
+ );
2121
+ $e->setResponseObject($data);
2122
+ break;
2123
+ }
2124
+ throw $e;
2125
+ }
2126
+ }
2127
+
2128
+ /**
2129
+ * Operation getChildDomainsAsync
2130
+ *
2131
+ * Gets all the sender domains of a specific child account
2132
+ *
2133
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2134
+ *
2135
+ * @throws \InvalidArgumentException
2136
+ * @return \GuzzleHttp\Promise\PromiseInterface
2137
+ */
2138
+ public function getChildDomainsAsync($childAuthKey)
2139
+ {
2140
+ return $this->getChildDomainsAsyncWithHttpInfo($childAuthKey)
2141
+ ->then(
2142
+ function ($response) {
2143
+ return $response[0];
2144
+ }
2145
+ );
2146
+ }
2147
+
2148
+ /**
2149
+ * Operation getChildDomainsAsyncWithHttpInfo
2150
+ *
2151
+ * Gets all the sender domains of a specific child account
2152
+ *
2153
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2154
+ *
2155
+ * @throws \InvalidArgumentException
2156
+ * @return \GuzzleHttp\Promise\PromiseInterface
2157
+ */
2158
+ public function getChildDomainsAsyncWithHttpInfo($childAuthKey)
2159
+ {
2160
+ $returnType = '\SendinBlue\Client\Model\GetChildDomains';
2161
+ $request = $this->getChildDomainsRequest($childAuthKey);
2162
+
2163
+ return $this->client
2164
+ ->sendAsync($request, $this->createHttpClientOption())
2165
+ ->then(
2166
+ function ($response) use ($returnType) {
2167
+ $responseBody = $response->getBody();
2168
+ if ($returnType === '\SplFileObject') {
2169
+ $content = $responseBody; //stream goes to serializer
2170
+ } else {
2171
+ $content = $responseBody->getContents();
2172
+ if ($returnType !== 'string') {
2173
+ $content = json_decode($content);
2174
+ }
2175
+ }
2176
+
2177
+ return [
2178
+ ObjectSerializer::deserialize($content, $returnType, []),
2179
+ $response->getStatusCode(),
2180
+ $response->getHeaders()
2181
+ ];
2182
+ },
2183
+ function ($exception) {
2184
+ $response = $exception->getResponse();
2185
+ $statusCode = $response->getStatusCode();
2186
+ throw new ApiException(
2187
+ sprintf(
2188
+ '[%d] Error connecting to the API (%s)',
2189
+ $statusCode,
2190
+ $exception->getRequest()->getUri()
2191
+ ),
2192
+ $statusCode,
2193
+ $response->getHeaders(),
2194
+ $response->getBody()
2195
+ );
2196
+ }
2197
+ );
2198
+ }
2199
+
2200
+ /**
2201
+ * Create request for operation 'getChildDomains'
2202
+ *
2203
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2204
+ *
2205
+ * @throws \InvalidArgumentException
2206
+ * @return \GuzzleHttp\Psr7\Request
2207
+ */
2208
+ protected function getChildDomainsRequest($childAuthKey)
2209
+ {
2210
+ // verify the required parameter 'childAuthKey' is set
2211
+ if ($childAuthKey === null) {
2212
+ throw new \InvalidArgumentException(
2213
+ 'Missing the required parameter $childAuthKey when calling getChildDomains'
2214
+ );
2215
+ }
2216
+
2217
+ $resourcePath = '/reseller/children/{childAuthKey}/domains';
2218
+ $formParams = [];
2219
+ $queryParams = [];
2220
+ $headerParams = [];
2221
+ $httpBody = '';
2222
+ $multipart = false;
2223
+
2224
+
2225
+ // path params
2226
+ if ($childAuthKey !== null) {
2227
+ $resourcePath = str_replace(
2228
+ '{' . 'childAuthKey' . '}',
2229
+ ObjectSerializer::toPathValue($childAuthKey),
2230
+ $resourcePath
2231
+ );
2232
+ }
2233
+
2234
+ // body params
2235
+ $_tempBody = null;
2236
+
2237
+ if ($multipart) {
2238
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2239
+ ['application/json']
2240
+ );
2241
+ } else {
2242
+ $headers = $this->headerSelector->selectHeaders(
2243
+ ['application/json'],
2244
+ ['application/json']
2245
+ );
2246
+ }
2247
+
2248
+ // for model (json/xml)
2249
+ if (isset($_tempBody)) {
2250
+ // $_tempBody is the method argument, if present
2251
+ $httpBody = $_tempBody;
2252
+ // \stdClass has no __toString(), so we should encode it manually
2253
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
2254
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
2255
+ }
2256
+ } elseif (count($formParams) > 0) {
2257
+ if ($multipart) {
2258
+ $multipartContents = [];
2259
+ foreach ($formParams as $formParamName => $formParamValue) {
2260
+ $multipartContents[] = [
2261
+ 'name' => $formParamName,
2262
+ 'contents' => $formParamValue
2263
+ ];
2264
+ }
2265
+ // for HTTP post (form)
2266
+ $httpBody = new MultipartStream($multipartContents);
2267
+
2268
+ } elseif ($headers['Content-Type'] === 'application/json') {
2269
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2270
+
2271
+ } else {
2272
+ // for HTTP post (form)
2273
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2274
+ }
2275
+ }
2276
+
2277
+ // this endpoint requires API key authentication
2278
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2279
+ if ($apiKey !== null) {
2280
+ $headers['api-key'] = $apiKey;
2281
+ }
2282
+ // this endpoint requires API key authentication
2283
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2284
+ if ($apiKey !== null) {
2285
+ $headers['partner-key'] = $apiKey;
2286
+ }
2287
+
2288
+ $defaultHeaders = [];
2289
+ if ($this->config->getUserAgent()) {
2290
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2291
+ }
2292
+
2293
+ $headers = array_merge(
2294
+ $defaultHeaders,
2295
+ $headerParams,
2296
+ $headers
2297
+ );
2298
+
2299
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2300
+ return new Request(
2301
+ 'GET',
2302
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2303
+ $headers,
2304
+ $httpBody
2305
+ );
2306
+ }
2307
+
2308
+ /**
2309
+ * Operation getChildInfo
2310
+ *
2311
+ * Gets the info about a specific child account
2312
+ *
2313
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2314
+ *
2315
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2316
+ * @throws \InvalidArgumentException
2317
+ * @return \SendinBlue\Client\Model\GetChildInfo
2318
+ */
2319
+ public function getChildInfo($childAuthKey)
2320
+ {
2321
+ list($response) = $this->getChildInfoWithHttpInfo($childAuthKey);
2322
+ return $response;
2323
+ }
2324
+
2325
+ /**
2326
+ * Operation getChildInfoWithHttpInfo
2327
+ *
2328
+ * Gets the info about a specific child account
2329
+ *
2330
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2331
+ *
2332
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2333
+ * @throws \InvalidArgumentException
2334
+ * @return array of \SendinBlue\Client\Model\GetChildInfo, HTTP status code, HTTP response headers (array of strings)
2335
+ */
2336
+ public function getChildInfoWithHttpInfo($childAuthKey)
2337
+ {
2338
+ $returnType = '\SendinBlue\Client\Model\GetChildInfo';
2339
+ $request = $this->getChildInfoRequest($childAuthKey);
2340
+
2341
+ try {
2342
+ $options = $this->createHttpClientOption();
2343
+ try {
2344
+ $response = $this->client->send($request, $options);
2345
+ } catch (RequestException $e) {
2346
+ throw new ApiException(
2347
+ "[{$e->getCode()}] {$e->getMessage()}",
2348
+ $e->getCode(),
2349
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2350
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2351
+ );
2352
+ }
2353
+
2354
+ $statusCode = $response->getStatusCode();
2355
+
2356
+ if ($statusCode < 200 || $statusCode > 299) {
2357
+ throw new ApiException(
2358
+ sprintf(
2359
+ '[%d] Error connecting to the API (%s)',
2360
+ $statusCode,
2361
+ $request->getUri()
2362
+ ),
2363
+ $statusCode,
2364
+ $response->getHeaders(),
2365
+ $response->getBody()
2366
+ );
2367
+ }
2368
+
2369
+ $responseBody = $response->getBody();
2370
+ if ($returnType === '\SplFileObject') {
2371
+ $content = $responseBody; //stream goes to serializer
2372
+ } else {
2373
+ $content = $responseBody->getContents();
2374
+ if ($returnType !== 'string') {
2375
+ $content = json_decode($content);
2376
+ }
2377
+ }
2378
+
2379
+ return [
2380
+ ObjectSerializer::deserialize($content, $returnType, []),
2381
+ $response->getStatusCode(),
2382
+ $response->getHeaders()
2383
+ ];
2384
+
2385
+ } catch (ApiException $e) {
2386
+ switch ($e->getCode()) {
2387
+ case 200:
2388
+ $data = ObjectSerializer::deserialize(
2389
+ $e->getResponseBody(),
2390
+ '\SendinBlue\Client\Model\GetChildInfo',
2391
+ $e->getResponseHeaders()
2392
+ );
2393
+ $e->setResponseObject($data);
2394
+ break;
2395
+ case 400:
2396
+ $data = ObjectSerializer::deserialize(
2397
+ $e->getResponseBody(),
2398
+ '\SendinBlue\Client\Model\ErrorModel',
2399
+ $e->getResponseHeaders()
2400
+ );
2401
+ $e->setResponseObject($data);
2402
+ break;
2403
+ case 403:
2404
+ $data = ObjectSerializer::deserialize(
2405
+ $e->getResponseBody(),
2406
+ '\SendinBlue\Client\Model\ErrorModel',
2407
+ $e->getResponseHeaders()
2408
+ );
2409
+ $e->setResponseObject($data);
2410
+ break;
2411
+ case 404:
2412
+ $data = ObjectSerializer::deserialize(
2413
+ $e->getResponseBody(),
2414
+ '\SendinBlue\Client\Model\ErrorModel',
2415
+ $e->getResponseHeaders()
2416
+ );
2417
+ $e->setResponseObject($data);
2418
+ break;
2419
+ }
2420
+ throw $e;
2421
+ }
2422
+ }
2423
+
2424
+ /**
2425
+ * Operation getChildInfoAsync
2426
+ *
2427
+ * Gets the info about a specific child account
2428
+ *
2429
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2430
+ *
2431
+ * @throws \InvalidArgumentException
2432
+ * @return \GuzzleHttp\Promise\PromiseInterface
2433
+ */
2434
+ public function getChildInfoAsync($childAuthKey)
2435
+ {
2436
+ return $this->getChildInfoAsyncWithHttpInfo($childAuthKey)
2437
+ ->then(
2438
+ function ($response) {
2439
+ return $response[0];
2440
+ }
2441
+ );
2442
+ }
2443
+
2444
+ /**
2445
+ * Operation getChildInfoAsyncWithHttpInfo
2446
+ *
2447
+ * Gets the info about a specific child account
2448
+ *
2449
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2450
+ *
2451
+ * @throws \InvalidArgumentException
2452
+ * @return \GuzzleHttp\Promise\PromiseInterface
2453
+ */
2454
+ public function getChildInfoAsyncWithHttpInfo($childAuthKey)
2455
+ {
2456
+ $returnType = '\SendinBlue\Client\Model\GetChildInfo';
2457
+ $request = $this->getChildInfoRequest($childAuthKey);
2458
+
2459
+ return $this->client
2460
+ ->sendAsync($request, $this->createHttpClientOption())
2461
+ ->then(
2462
+ function ($response) use ($returnType) {
2463
+ $responseBody = $response->getBody();
2464
+ if ($returnType === '\SplFileObject') {
2465
+ $content = $responseBody; //stream goes to serializer
2466
+ } else {
2467
+ $content = $responseBody->getContents();
2468
+ if ($returnType !== 'string') {
2469
+ $content = json_decode($content);
2470
+ }
2471
+ }
2472
+
2473
+ return [
2474
+ ObjectSerializer::deserialize($content, $returnType, []),
2475
+ $response->getStatusCode(),
2476
+ $response->getHeaders()
2477
+ ];
2478
+ },
2479
+ function ($exception) {
2480
+ $response = $exception->getResponse();
2481
+ $statusCode = $response->getStatusCode();
2482
+ throw new ApiException(
2483
+ sprintf(
2484
+ '[%d] Error connecting to the API (%s)',
2485
+ $statusCode,
2486
+ $exception->getRequest()->getUri()
2487
+ ),
2488
+ $statusCode,
2489
+ $response->getHeaders(),
2490
+ $response->getBody()
2491
+ );
2492
+ }
2493
+ );
2494
+ }
2495
+
2496
+ /**
2497
+ * Create request for operation 'getChildInfo'
2498
+ *
2499
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2500
+ *
2501
+ * @throws \InvalidArgumentException
2502
+ * @return \GuzzleHttp\Psr7\Request
2503
+ */
2504
+ protected function getChildInfoRequest($childAuthKey)
2505
+ {
2506
+ // verify the required parameter 'childAuthKey' is set
2507
+ if ($childAuthKey === null) {
2508
+ throw new \InvalidArgumentException(
2509
+ 'Missing the required parameter $childAuthKey when calling getChildInfo'
2510
+ );
2511
+ }
2512
+
2513
+ $resourcePath = '/reseller/children/{childAuthKey}';
2514
+ $formParams = [];
2515
+ $queryParams = [];
2516
+ $headerParams = [];
2517
+ $httpBody = '';
2518
+ $multipart = false;
2519
+
2520
+
2521
+ // path params
2522
+ if ($childAuthKey !== null) {
2523
+ $resourcePath = str_replace(
2524
+ '{' . 'childAuthKey' . '}',
2525
+ ObjectSerializer::toPathValue($childAuthKey),
2526
+ $resourcePath
2527
+ );
2528
+ }
2529
+
2530
+ // body params
2531
+ $_tempBody = null;
2532
+
2533
+ if ($multipart) {
2534
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2535
+ ['application/json']
2536
+ );
2537
+ } else {
2538
+ $headers = $this->headerSelector->selectHeaders(
2539
+ ['application/json'],
2540
+ ['application/json']
2541
+ );
2542
+ }
2543
+
2544
+ // for model (json/xml)
2545
+ if (isset($_tempBody)) {
2546
+ // $_tempBody is the method argument, if present
2547
+ $httpBody = $_tempBody;
2548
+ // \stdClass has no __toString(), so we should encode it manually
2549
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
2550
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
2551
+ }
2552
+ } elseif (count($formParams) > 0) {
2553
+ if ($multipart) {
2554
+ $multipartContents = [];
2555
+ foreach ($formParams as $formParamName => $formParamValue) {
2556
+ $multipartContents[] = [
2557
+ 'name' => $formParamName,
2558
+ 'contents' => $formParamValue
2559
+ ];
2560
+ }
2561
+ // for HTTP post (form)
2562
+ $httpBody = new MultipartStream($multipartContents);
2563
+
2564
+ } elseif ($headers['Content-Type'] === 'application/json') {
2565
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2566
+
2567
+ } else {
2568
+ // for HTTP post (form)
2569
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2570
+ }
2571
+ }
2572
+
2573
+ // this endpoint requires API key authentication
2574
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2575
+ if ($apiKey !== null) {
2576
+ $headers['api-key'] = $apiKey;
2577
+ }
2578
+ // this endpoint requires API key authentication
2579
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2580
+ if ($apiKey !== null) {
2581
+ $headers['partner-key'] = $apiKey;
2582
+ }
2583
+
2584
+ $defaultHeaders = [];
2585
+ if ($this->config->getUserAgent()) {
2586
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2587
+ }
2588
+
2589
+ $headers = array_merge(
2590
+ $defaultHeaders,
2591
+ $headerParams,
2592
+ $headers
2593
+ );
2594
+
2595
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2596
+ return new Request(
2597
+ 'GET',
2598
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2599
+ $headers,
2600
+ $httpBody
2601
+ );
2602
+ }
2603
+
2604
+ /**
2605
+ * Operation getResellerChilds
2606
+ *
2607
+ * Gets the list of all reseller's children accounts
2608
+ *
2609
+ *
2610
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2611
+ * @throws \InvalidArgumentException
2612
+ * @return \SendinBlue\Client\Model\GetChildrenList
2613
+ */
2614
+ public function getResellerChilds()
2615
+ {
2616
+ list($response) = $this->getResellerChildsWithHttpInfo();
2617
+ return $response;
2618
+ }
2619
+
2620
+ /**
2621
+ * Operation getResellerChildsWithHttpInfo
2622
+ *
2623
+ * Gets the list of all reseller's children accounts
2624
+ *
2625
+ *
2626
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2627
+ * @throws \InvalidArgumentException
2628
+ * @return array of \SendinBlue\Client\Model\GetChildrenList, HTTP status code, HTTP response headers (array of strings)
2629
+ */
2630
+ public function getResellerChildsWithHttpInfo()
2631
+ {
2632
+ $returnType = '\SendinBlue\Client\Model\GetChildrenList';
2633
+ $request = $this->getResellerChildsRequest();
2634
+
2635
+ try {
2636
+ $options = $this->createHttpClientOption();
2637
+ try {
2638
+ $response = $this->client->send($request, $options);
2639
+ } catch (RequestException $e) {
2640
+ throw new ApiException(
2641
+ "[{$e->getCode()}] {$e->getMessage()}",
2642
+ $e->getCode(),
2643
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2644
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2645
+ );
2646
+ }
2647
+
2648
+ $statusCode = $response->getStatusCode();
2649
+
2650
+ if ($statusCode < 200 || $statusCode > 299) {
2651
+ throw new ApiException(
2652
+ sprintf(
2653
+ '[%d] Error connecting to the API (%s)',
2654
+ $statusCode,
2655
+ $request->getUri()
2656
+ ),
2657
+ $statusCode,
2658
+ $response->getHeaders(),
2659
+ $response->getBody()
2660
+ );
2661
+ }
2662
+
2663
+ $responseBody = $response->getBody();
2664
+ if ($returnType === '\SplFileObject') {
2665
+ $content = $responseBody; //stream goes to serializer
2666
+ } else {
2667
+ $content = $responseBody->getContents();
2668
+ if ($returnType !== 'string') {
2669
+ $content = json_decode($content);
2670
+ }
2671
+ }
2672
+
2673
+ return [
2674
+ ObjectSerializer::deserialize($content, $returnType, []),
2675
+ $response->getStatusCode(),
2676
+ $response->getHeaders()
2677
+ ];
2678
+
2679
+ } catch (ApiException $e) {
2680
+ switch ($e->getCode()) {
2681
+ case 200:
2682
+ $data = ObjectSerializer::deserialize(
2683
+ $e->getResponseBody(),
2684
+ '\SendinBlue\Client\Model\GetChildrenList',
2685
+ $e->getResponseHeaders()
2686
+ );
2687
+ $e->setResponseObject($data);
2688
+ break;
2689
+ case 403:
2690
+ $data = ObjectSerializer::deserialize(
2691
+ $e->getResponseBody(),
2692
+ '\SendinBlue\Client\Model\ErrorModel',
2693
+ $e->getResponseHeaders()
2694
+ );
2695
+ $e->setResponseObject($data);
2696
+ break;
2697
+ }
2698
+ throw $e;
2699
+ }
2700
+ }
2701
+
2702
+ /**
2703
+ * Operation getResellerChildsAsync
2704
+ *
2705
+ * Gets the list of all reseller's children accounts
2706
+ *
2707
+ *
2708
+ * @throws \InvalidArgumentException
2709
+ * @return \GuzzleHttp\Promise\PromiseInterface
2710
+ */
2711
+ public function getResellerChildsAsync()
2712
+ {
2713
+ return $this->getResellerChildsAsyncWithHttpInfo()
2714
+ ->then(
2715
+ function ($response) {
2716
+ return $response[0];
2717
+ }
2718
+ );
2719
+ }
2720
+
2721
+ /**
2722
+ * Operation getResellerChildsAsyncWithHttpInfo
2723
+ *
2724
+ * Gets the list of all reseller's children accounts
2725
+ *
2726
+ *
2727
+ * @throws \InvalidArgumentException
2728
+ * @return \GuzzleHttp\Promise\PromiseInterface
2729
+ */
2730
+ public function getResellerChildsAsyncWithHttpInfo()
2731
+ {
2732
+ $returnType = '\SendinBlue\Client\Model\GetChildrenList';
2733
+ $request = $this->getResellerChildsRequest();
2734
+
2735
+ return $this->client
2736
+ ->sendAsync($request, $this->createHttpClientOption())
2737
+ ->then(
2738
+ function ($response) use ($returnType) {
2739
+ $responseBody = $response->getBody();
2740
+ if ($returnType === '\SplFileObject') {
2741
+ $content = $responseBody; //stream goes to serializer
2742
+ } else {
2743
+ $content = $responseBody->getContents();
2744
+ if ($returnType !== 'string') {
2745
+ $content = json_decode($content);
2746
+ }
2747
+ }
2748
+
2749
+ return [
2750
+ ObjectSerializer::deserialize($content, $returnType, []),
2751
+ $response->getStatusCode(),
2752
+ $response->getHeaders()
2753
+ ];
2754
+ },
2755
+ function ($exception) {
2756
+ $response = $exception->getResponse();
2757
+ $statusCode = $response->getStatusCode();
2758
+ throw new ApiException(
2759
+ sprintf(
2760
+ '[%d] Error connecting to the API (%s)',
2761
+ $statusCode,
2762
+ $exception->getRequest()->getUri()
2763
+ ),
2764
+ $statusCode,
2765
+ $response->getHeaders(),
2766
+ $response->getBody()
2767
+ );
2768
+ }
2769
+ );
2770
+ }
2771
+
2772
+ /**
2773
+ * Create request for operation 'getResellerChilds'
2774
+ *
2775
+ *
2776
+ * @throws \InvalidArgumentException
2777
+ * @return \GuzzleHttp\Psr7\Request
2778
+ */
2779
+ protected function getResellerChildsRequest()
2780
+ {
2781
+
2782
+ $resourcePath = '/reseller/children';
2783
+ $formParams = [];
2784
+ $queryParams = [];
2785
+ $headerParams = [];
2786
+ $httpBody = '';
2787
+ $multipart = false;
2788
+
2789
+
2790
+
2791
+ // body params
2792
+ $_tempBody = null;
2793
+
2794
+ if ($multipart) {
2795
+ $headers = $this->headerSelector->selectHeadersForMultipart(
2796
+ ['application/json']
2797
+ );
2798
+ } else {
2799
+ $headers = $this->headerSelector->selectHeaders(
2800
+ ['application/json'],
2801
+ ['application/json']
2802
+ );
2803
+ }
2804
+
2805
+ // for model (json/xml)
2806
+ if (isset($_tempBody)) {
2807
+ // $_tempBody is the method argument, if present
2808
+ $httpBody = $_tempBody;
2809
+ // \stdClass has no __toString(), so we should encode it manually
2810
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
2811
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
2812
+ }
2813
+ } elseif (count($formParams) > 0) {
2814
+ if ($multipart) {
2815
+ $multipartContents = [];
2816
+ foreach ($formParams as $formParamName => $formParamValue) {
2817
+ $multipartContents[] = [
2818
+ 'name' => $formParamName,
2819
+ 'contents' => $formParamValue
2820
+ ];
2821
+ }
2822
+ // for HTTP post (form)
2823
+ $httpBody = new MultipartStream($multipartContents);
2824
+
2825
+ } elseif ($headers['Content-Type'] === 'application/json') {
2826
+ $httpBody = \GuzzleHttp\json_encode($formParams);
2827
+
2828
+ } else {
2829
+ // for HTTP post (form)
2830
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
2831
+ }
2832
+ }
2833
+
2834
+ // this endpoint requires API key authentication
2835
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
2836
+ if ($apiKey !== null) {
2837
+ $headers['api-key'] = $apiKey;
2838
+ }
2839
+ // this endpoint requires API key authentication
2840
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
2841
+ if ($apiKey !== null) {
2842
+ $headers['partner-key'] = $apiKey;
2843
+ }
2844
+
2845
+ $defaultHeaders = [];
2846
+ if ($this->config->getUserAgent()) {
2847
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
2848
+ }
2849
+
2850
+ $headers = array_merge(
2851
+ $defaultHeaders,
2852
+ $headerParams,
2853
+ $headers
2854
+ );
2855
+
2856
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
2857
+ return new Request(
2858
+ 'GET',
2859
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
2860
+ $headers,
2861
+ $httpBody
2862
+ );
2863
+ }
2864
+
2865
+ /**
2866
+ * Operation getSsoToken
2867
+ *
2868
+ * Get session token to access Sendinblue (SSO)
2869
+ *
2870
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2871
+ *
2872
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2873
+ * @throws \InvalidArgumentException
2874
+ * @return \SendinBlue\Client\Model\GetSsoToken
2875
+ */
2876
+ public function getSsoToken($childAuthKey)
2877
+ {
2878
+ list($response) = $this->getSsoTokenWithHttpInfo($childAuthKey);
2879
+ return $response;
2880
+ }
2881
+
2882
+ /**
2883
+ * Operation getSsoTokenWithHttpInfo
2884
+ *
2885
+ * Get session token to access Sendinblue (SSO)
2886
+ *
2887
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2888
+ *
2889
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
2890
+ * @throws \InvalidArgumentException
2891
+ * @return array of \SendinBlue\Client\Model\GetSsoToken, HTTP status code, HTTP response headers (array of strings)
2892
+ */
2893
+ public function getSsoTokenWithHttpInfo($childAuthKey)
2894
+ {
2895
+ $returnType = '\SendinBlue\Client\Model\GetSsoToken';
2896
+ $request = $this->getSsoTokenRequest($childAuthKey);
2897
+
2898
+ try {
2899
+ $options = $this->createHttpClientOption();
2900
+ try {
2901
+ $response = $this->client->send($request, $options);
2902
+ } catch (RequestException $e) {
2903
+ throw new ApiException(
2904
+ "[{$e->getCode()}] {$e->getMessage()}",
2905
+ $e->getCode(),
2906
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
2907
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
2908
+ );
2909
+ }
2910
+
2911
+ $statusCode = $response->getStatusCode();
2912
+
2913
+ if ($statusCode < 200 || $statusCode > 299) {
2914
+ throw new ApiException(
2915
+ sprintf(
2916
+ '[%d] Error connecting to the API (%s)',
2917
+ $statusCode,
2918
+ $request->getUri()
2919
+ ),
2920
+ $statusCode,
2921
+ $response->getHeaders(),
2922
+ $response->getBody()
2923
+ );
2924
+ }
2925
+
2926
+ $responseBody = $response->getBody();
2927
+ if ($returnType === '\SplFileObject') {
2928
+ $content = $responseBody; //stream goes to serializer
2929
+ } else {
2930
+ $content = $responseBody->getContents();
2931
+ if ($returnType !== 'string') {
2932
+ $content = json_decode($content);
2933
+ }
2934
+ }
2935
+
2936
+ return [
2937
+ ObjectSerializer::deserialize($content, $returnType, []),
2938
+ $response->getStatusCode(),
2939
+ $response->getHeaders()
2940
+ ];
2941
+
2942
+ } catch (ApiException $e) {
2943
+ switch ($e->getCode()) {
2944
+ case 200:
2945
+ $data = ObjectSerializer::deserialize(
2946
+ $e->getResponseBody(),
2947
+ '\SendinBlue\Client\Model\GetSsoToken',
2948
+ $e->getResponseHeaders()
2949
+ );
2950
+ $e->setResponseObject($data);
2951
+ break;
2952
+ case 400:
2953
+ $data = ObjectSerializer::deserialize(
2954
+ $e->getResponseBody(),
2955
+ '\SendinBlue\Client\Model\ErrorModel',
2956
+ $e->getResponseHeaders()
2957
+ );
2958
+ $e->setResponseObject($data);
2959
+ break;
2960
+ case 403:
2961
+ $data = ObjectSerializer::deserialize(
2962
+ $e->getResponseBody(),
2963
+ '\SendinBlue\Client\Model\ErrorModel',
2964
+ $e->getResponseHeaders()
2965
+ );
2966
+ $e->setResponseObject($data);
2967
+ break;
2968
+ case 404:
2969
+ $data = ObjectSerializer::deserialize(
2970
+ $e->getResponseBody(),
2971
+ '\SendinBlue\Client\Model\ErrorModel',
2972
+ $e->getResponseHeaders()
2973
+ );
2974
+ $e->setResponseObject($data);
2975
+ break;
2976
+ }
2977
+ throw $e;
2978
+ }
2979
+ }
2980
+
2981
+ /**
2982
+ * Operation getSsoTokenAsync
2983
+ *
2984
+ * Get session token to access Sendinblue (SSO)
2985
+ *
2986
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
2987
+ *
2988
+ * @throws \InvalidArgumentException
2989
+ * @return \GuzzleHttp\Promise\PromiseInterface
2990
+ */
2991
+ public function getSsoTokenAsync($childAuthKey)
2992
+ {
2993
+ return $this->getSsoTokenAsyncWithHttpInfo($childAuthKey)
2994
+ ->then(
2995
+ function ($response) {
2996
+ return $response[0];
2997
+ }
2998
+ );
2999
+ }
3000
+
3001
+ /**
3002
+ * Operation getSsoTokenAsyncWithHttpInfo
3003
+ *
3004
+ * Get session token to access Sendinblue (SSO)
3005
+ *
3006
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3007
+ *
3008
+ * @throws \InvalidArgumentException
3009
+ * @return \GuzzleHttp\Promise\PromiseInterface
3010
+ */
3011
+ public function getSsoTokenAsyncWithHttpInfo($childAuthKey)
3012
+ {
3013
+ $returnType = '\SendinBlue\Client\Model\GetSsoToken';
3014
+ $request = $this->getSsoTokenRequest($childAuthKey);
3015
+
3016
+ return $this->client
3017
+ ->sendAsync($request, $this->createHttpClientOption())
3018
+ ->then(
3019
+ function ($response) use ($returnType) {
3020
+ $responseBody = $response->getBody();
3021
+ if ($returnType === '\SplFileObject') {
3022
+ $content = $responseBody; //stream goes to serializer
3023
+ } else {
3024
+ $content = $responseBody->getContents();
3025
+ if ($returnType !== 'string') {
3026
+ $content = json_decode($content);
3027
+ }
3028
+ }
3029
+
3030
+ return [
3031
+ ObjectSerializer::deserialize($content, $returnType, []),
3032
+ $response->getStatusCode(),
3033
+ $response->getHeaders()
3034
+ ];
3035
+ },
3036
+ function ($exception) {
3037
+ $response = $exception->getResponse();
3038
+ $statusCode = $response->getStatusCode();
3039
+ throw new ApiException(
3040
+ sprintf(
3041
+ '[%d] Error connecting to the API (%s)',
3042
+ $statusCode,
3043
+ $exception->getRequest()->getUri()
3044
+ ),
3045
+ $statusCode,
3046
+ $response->getHeaders(),
3047
+ $response->getBody()
3048
+ );
3049
+ }
3050
+ );
3051
+ }
3052
+
3053
+ /**
3054
+ * Create request for operation 'getSsoToken'
3055
+ *
3056
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3057
+ *
3058
+ * @throws \InvalidArgumentException
3059
+ * @return \GuzzleHttp\Psr7\Request
3060
+ */
3061
+ protected function getSsoTokenRequest($childAuthKey)
3062
+ {
3063
+ // verify the required parameter 'childAuthKey' is set
3064
+ if ($childAuthKey === null) {
3065
+ throw new \InvalidArgumentException(
3066
+ 'Missing the required parameter $childAuthKey when calling getSsoToken'
3067
+ );
3068
+ }
3069
+
3070
+ $resourcePath = '/reseller/children/{childAuthKey}/auth';
3071
+ $formParams = [];
3072
+ $queryParams = [];
3073
+ $headerParams = [];
3074
+ $httpBody = '';
3075
+ $multipart = false;
3076
+
3077
+
3078
+ // path params
3079
+ if ($childAuthKey !== null) {
3080
+ $resourcePath = str_replace(
3081
+ '{' . 'childAuthKey' . '}',
3082
+ ObjectSerializer::toPathValue($childAuthKey),
3083
+ $resourcePath
3084
+ );
3085
+ }
3086
+
3087
+ // body params
3088
+ $_tempBody = null;
3089
+
3090
+ if ($multipart) {
3091
+ $headers = $this->headerSelector->selectHeadersForMultipart(
3092
+ ['application/json']
3093
+ );
3094
+ } else {
3095
+ $headers = $this->headerSelector->selectHeaders(
3096
+ ['application/json'],
3097
+ ['application/json']
3098
+ );
3099
+ }
3100
+
3101
+ // for model (json/xml)
3102
+ if (isset($_tempBody)) {
3103
+ // $_tempBody is the method argument, if present
3104
+ $httpBody = $_tempBody;
3105
+ // \stdClass has no __toString(), so we should encode it manually
3106
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
3107
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
3108
+ }
3109
+ } elseif (count($formParams) > 0) {
3110
+ if ($multipart) {
3111
+ $multipartContents = [];
3112
+ foreach ($formParams as $formParamName => $formParamValue) {
3113
+ $multipartContents[] = [
3114
+ 'name' => $formParamName,
3115
+ 'contents' => $formParamValue
3116
+ ];
3117
+ }
3118
+ // for HTTP post (form)
3119
+ $httpBody = new MultipartStream($multipartContents);
3120
+
3121
+ } elseif ($headers['Content-Type'] === 'application/json') {
3122
+ $httpBody = \GuzzleHttp\json_encode($formParams);
3123
+
3124
+ } else {
3125
+ // for HTTP post (form)
3126
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
3127
+ }
3128
+ }
3129
+
3130
+ // this endpoint requires API key authentication
3131
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
3132
+ if ($apiKey !== null) {
3133
+ $headers['api-key'] = $apiKey;
3134
+ }
3135
+ // this endpoint requires API key authentication
3136
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
3137
+ if ($apiKey !== null) {
3138
+ $headers['partner-key'] = $apiKey;
3139
+ }
3140
+
3141
+ $defaultHeaders = [];
3142
+ if ($this->config->getUserAgent()) {
3143
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
3144
+ }
3145
+
3146
+ $headers = array_merge(
3147
+ $defaultHeaders,
3148
+ $headerParams,
3149
+ $headers
3150
+ );
3151
+
3152
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
3153
+ return new Request(
3154
+ 'GET',
3155
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
3156
+ $headers,
3157
+ $httpBody
3158
+ );
3159
+ }
3160
+
3161
+ /**
3162
+ * Operation removeCredits
3163
+ *
3164
+ * Remove Email and/or SMS credits from a specific child account
3165
+ *
3166
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3167
+ * @param \SendinBlue\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required)
3168
+ *
3169
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3170
+ * @throws \InvalidArgumentException
3171
+ * @return \SendinBlue\Client\Model\RemainingCreditModel
3172
+ */
3173
+ public function removeCredits($childAuthKey, $removeCredits)
3174
+ {
3175
+ list($response) = $this->removeCreditsWithHttpInfo($childAuthKey, $removeCredits);
3176
+ return $response;
3177
+ }
3178
+
3179
+ /**
3180
+ * Operation removeCreditsWithHttpInfo
3181
+ *
3182
+ * Remove Email and/or SMS credits from a specific child account
3183
+ *
3184
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3185
+ * @param \SendinBlue\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required)
3186
+ *
3187
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3188
+ * @throws \InvalidArgumentException
3189
+ * @return array of \SendinBlue\Client\Model\RemainingCreditModel, HTTP status code, HTTP response headers (array of strings)
3190
+ */
3191
+ public function removeCreditsWithHttpInfo($childAuthKey, $removeCredits)
3192
+ {
3193
+ $returnType = '\SendinBlue\Client\Model\RemainingCreditModel';
3194
+ $request = $this->removeCreditsRequest($childAuthKey, $removeCredits);
3195
+
3196
+ try {
3197
+ $options = $this->createHttpClientOption();
3198
+ try {
3199
+ $response = $this->client->send($request, $options);
3200
+ } catch (RequestException $e) {
3201
+ throw new ApiException(
3202
+ "[{$e->getCode()}] {$e->getMessage()}",
3203
+ $e->getCode(),
3204
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
3205
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
3206
+ );
3207
+ }
3208
+
3209
+ $statusCode = $response->getStatusCode();
3210
+
3211
+ if ($statusCode < 200 || $statusCode > 299) {
3212
+ throw new ApiException(
3213
+ sprintf(
3214
+ '[%d] Error connecting to the API (%s)',
3215
+ $statusCode,
3216
+ $request->getUri()
3217
+ ),
3218
+ $statusCode,
3219
+ $response->getHeaders(),
3220
+ $response->getBody()
3221
+ );
3222
+ }
3223
+
3224
+ $responseBody = $response->getBody();
3225
+ if ($returnType === '\SplFileObject') {
3226
+ $content = $responseBody; //stream goes to serializer
3227
+ } else {
3228
+ $content = $responseBody->getContents();
3229
+ if ($returnType !== 'string') {
3230
+ $content = json_decode($content);
3231
+ }
3232
+ }
3233
+
3234
+ return [
3235
+ ObjectSerializer::deserialize($content, $returnType, []),
3236
+ $response->getStatusCode(),
3237
+ $response->getHeaders()
3238
+ ];
3239
+
3240
+ } catch (ApiException $e) {
3241
+ switch ($e->getCode()) {
3242
+ case 200:
3243
+ $data = ObjectSerializer::deserialize(
3244
+ $e->getResponseBody(),
3245
+ '\SendinBlue\Client\Model\RemainingCreditModel',
3246
+ $e->getResponseHeaders()
3247
+ );
3248
+ $e->setResponseObject($data);
3249
+ break;
3250
+ case 400:
3251
+ $data = ObjectSerializer::deserialize(
3252
+ $e->getResponseBody(),
3253
+ '\SendinBlue\Client\Model\ErrorModel',
3254
+ $e->getResponseHeaders()
3255
+ );
3256
+ $e->setResponseObject($data);
3257
+ break;
3258
+ case 403:
3259
+ $data = ObjectSerializer::deserialize(
3260
+ $e->getResponseBody(),
3261
+ '\SendinBlue\Client\Model\ErrorModel',
3262
+ $e->getResponseHeaders()
3263
+ );
3264
+ $e->setResponseObject($data);
3265
+ break;
3266
+ case 404:
3267
+ $data = ObjectSerializer::deserialize(
3268
+ $e->getResponseBody(),
3269
+ '\SendinBlue\Client\Model\ErrorModel',
3270
+ $e->getResponseHeaders()
3271
+ );
3272
+ $e->setResponseObject($data);
3273
+ break;
3274
+ }
3275
+ throw $e;
3276
+ }
3277
+ }
3278
+
3279
+ /**
3280
+ * Operation removeCreditsAsync
3281
+ *
3282
+ * Remove Email and/or SMS credits from a specific child account
3283
+ *
3284
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3285
+ * @param \SendinBlue\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required)
3286
+ *
3287
+ * @throws \InvalidArgumentException
3288
+ * @return \GuzzleHttp\Promise\PromiseInterface
3289
+ */
3290
+ public function removeCreditsAsync($childAuthKey, $removeCredits)
3291
+ {
3292
+ return $this->removeCreditsAsyncWithHttpInfo($childAuthKey, $removeCredits)
3293
+ ->then(
3294
+ function ($response) {
3295
+ return $response[0];
3296
+ }
3297
+ );
3298
+ }
3299
+
3300
+ /**
3301
+ * Operation removeCreditsAsyncWithHttpInfo
3302
+ *
3303
+ * Remove Email and/or SMS credits from a specific child account
3304
+ *
3305
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3306
+ * @param \SendinBlue\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required)
3307
+ *
3308
+ * @throws \InvalidArgumentException
3309
+ * @return \GuzzleHttp\Promise\PromiseInterface
3310
+ */
3311
+ public function removeCreditsAsyncWithHttpInfo($childAuthKey, $removeCredits)
3312
+ {
3313
+ $returnType = '\SendinBlue\Client\Model\RemainingCreditModel';
3314
+ $request = $this->removeCreditsRequest($childAuthKey, $removeCredits);
3315
+
3316
+ return $this->client
3317
+ ->sendAsync($request, $this->createHttpClientOption())
3318
+ ->then(
3319
+ function ($response) use ($returnType) {
3320
+ $responseBody = $response->getBody();
3321
+ if ($returnType === '\SplFileObject') {
3322
+ $content = $responseBody; //stream goes to serializer
3323
+ } else {
3324
+ $content = $responseBody->getContents();
3325
+ if ($returnType !== 'string') {
3326
+ $content = json_decode($content);
3327
+ }
3328
+ }
3329
+
3330
+ return [
3331
+ ObjectSerializer::deserialize($content, $returnType, []),
3332
+ $response->getStatusCode(),
3333
+ $response->getHeaders()
3334
+ ];
3335
+ },
3336
+ function ($exception) {
3337
+ $response = $exception->getResponse();
3338
+ $statusCode = $response->getStatusCode();
3339
+ throw new ApiException(
3340
+ sprintf(
3341
+ '[%d] Error connecting to the API (%s)',
3342
+ $statusCode,
3343
+ $exception->getRequest()->getUri()
3344
+ ),
3345
+ $statusCode,
3346
+ $response->getHeaders(),
3347
+ $response->getBody()
3348
+ );
3349
+ }
3350
+ );
3351
+ }
3352
+
3353
+ /**
3354
+ * Create request for operation 'removeCredits'
3355
+ *
3356
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3357
+ * @param \SendinBlue\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required)
3358
+ *
3359
+ * @throws \InvalidArgumentException
3360
+ * @return \GuzzleHttp\Psr7\Request
3361
+ */
3362
+ protected function removeCreditsRequest($childAuthKey, $removeCredits)
3363
+ {
3364
+ // verify the required parameter 'childAuthKey' is set
3365
+ if ($childAuthKey === null) {
3366
+ throw new \InvalidArgumentException(
3367
+ 'Missing the required parameter $childAuthKey when calling removeCredits'
3368
+ );
3369
+ }
3370
+ // verify the required parameter 'removeCredits' is set
3371
+ if ($removeCredits === null) {
3372
+ throw new \InvalidArgumentException(
3373
+ 'Missing the required parameter $removeCredits when calling removeCredits'
3374
+ );
3375
+ }
3376
+
3377
+ $resourcePath = '/reseller/children/{childAuthKey}/credits/remove';
3378
+ $formParams = [];
3379
+ $queryParams = [];
3380
+ $headerParams = [];
3381
+ $httpBody = '';
3382
+ $multipart = false;
3383
+
3384
+
3385
+ // path params
3386
+ if ($childAuthKey !== null) {
3387
+ $resourcePath = str_replace(
3388
+ '{' . 'childAuthKey' . '}',
3389
+ ObjectSerializer::toPathValue($childAuthKey),
3390
+ $resourcePath
3391
+ );
3392
+ }
3393
+
3394
+ // body params
3395
+ $_tempBody = null;
3396
+ if (isset($removeCredits)) {
3397
+ $_tempBody = $removeCredits;
3398
+ }
3399
+
3400
+ if ($multipart) {
3401
+ $headers = $this->headerSelector->selectHeadersForMultipart(
3402
+ ['application/json']
3403
+ );
3404
+ } else {
3405
+ $headers = $this->headerSelector->selectHeaders(
3406
+ ['application/json'],
3407
+ ['application/json']
3408
+ );
3409
+ }
3410
+
3411
+ // for model (json/xml)
3412
+ if (isset($_tempBody)) {
3413
+ // $_tempBody is the method argument, if present
3414
+ $httpBody = $_tempBody;
3415
+ // \stdClass has no __toString(), so we should encode it manually
3416
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
3417
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
3418
+ }
3419
+ } elseif (count($formParams) > 0) {
3420
+ if ($multipart) {
3421
+ $multipartContents = [];
3422
+ foreach ($formParams as $formParamName => $formParamValue) {
3423
+ $multipartContents[] = [
3424
+ 'name' => $formParamName,
3425
+ 'contents' => $formParamValue
3426
+ ];
3427
+ }
3428
+ // for HTTP post (form)
3429
+ $httpBody = new MultipartStream($multipartContents);
3430
+
3431
+ } elseif ($headers['Content-Type'] === 'application/json') {
3432
+ $httpBody = \GuzzleHttp\json_encode($formParams);
3433
+
3434
+ } else {
3435
+ // for HTTP post (form)
3436
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
3437
+ }
3438
+ }
3439
+
3440
+ // this endpoint requires API key authentication
3441
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
3442
+ if ($apiKey !== null) {
3443
+ $headers['api-key'] = $apiKey;
3444
+ }
3445
+ // this endpoint requires API key authentication
3446
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
3447
+ if ($apiKey !== null) {
3448
+ $headers['partner-key'] = $apiKey;
3449
+ }
3450
+
3451
+ $defaultHeaders = [];
3452
+ if ($this->config->getUserAgent()) {
3453
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
3454
+ }
3455
+
3456
+ $headers = array_merge(
3457
+ $defaultHeaders,
3458
+ $headerParams,
3459
+ $headers
3460
+ );
3461
+
3462
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
3463
+ return new Request(
3464
+ 'POST',
3465
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
3466
+ $headers,
3467
+ $httpBody
3468
+ );
3469
+ }
3470
+
3471
+ /**
3472
+ * Operation updateChildAccountStatus
3473
+ *
3474
+ * Updates infos of reseller's child account status based on the childAuthKey supplied
3475
+ *
3476
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3477
+ * @param \SendinBlue\Client\Model\UpdateChildAccountStatus $updateChildAccountStatus values to update in child account status (required)
3478
+ *
3479
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3480
+ * @throws \InvalidArgumentException
3481
+ * @return void
3482
+ */
3483
+ public function updateChildAccountStatus($childAuthKey, $updateChildAccountStatus)
3484
+ {
3485
+ $this->updateChildAccountStatusWithHttpInfo($childAuthKey, $updateChildAccountStatus);
3486
+ }
3487
+
3488
+ /**
3489
+ * Operation updateChildAccountStatusWithHttpInfo
3490
+ *
3491
+ * Updates infos of reseller's child account status based on the childAuthKey supplied
3492
+ *
3493
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3494
+ * @param \SendinBlue\Client\Model\UpdateChildAccountStatus $updateChildAccountStatus values to update in child account status (required)
3495
+ *
3496
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3497
+ * @throws \InvalidArgumentException
3498
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
3499
+ */
3500
+ public function updateChildAccountStatusWithHttpInfo($childAuthKey, $updateChildAccountStatus)
3501
+ {
3502
+ $returnType = '';
3503
+ $request = $this->updateChildAccountStatusRequest($childAuthKey, $updateChildAccountStatus);
3504
+
3505
+ try {
3506
+ $options = $this->createHttpClientOption();
3507
+ try {
3508
+ $response = $this->client->send($request, $options);
3509
+ } catch (RequestException $e) {
3510
+ throw new ApiException(
3511
+ "[{$e->getCode()}] {$e->getMessage()}",
3512
+ $e->getCode(),
3513
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
3514
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
3515
+ );
3516
+ }
3517
+
3518
+ $statusCode = $response->getStatusCode();
3519
+
3520
+ if ($statusCode < 200 || $statusCode > 299) {
3521
+ throw new ApiException(
3522
+ sprintf(
3523
+ '[%d] Error connecting to the API (%s)',
3524
+ $statusCode,
3525
+ $request->getUri()
3526
+ ),
3527
+ $statusCode,
3528
+ $response->getHeaders(),
3529
+ $response->getBody()
3530
+ );
3531
+ }
3532
+
3533
+ return [null, $statusCode, $response->getHeaders()];
3534
+
3535
+ } catch (ApiException $e) {
3536
+ switch ($e->getCode()) {
3537
+ case 400:
3538
+ $data = ObjectSerializer::deserialize(
3539
+ $e->getResponseBody(),
3540
+ '\SendinBlue\Client\Model\ErrorModel',
3541
+ $e->getResponseHeaders()
3542
+ );
3543
+ $e->setResponseObject($data);
3544
+ break;
3545
+ case 403:
3546
+ $data = ObjectSerializer::deserialize(
3547
+ $e->getResponseBody(),
3548
+ '\SendinBlue\Client\Model\ErrorModel',
3549
+ $e->getResponseHeaders()
3550
+ );
3551
+ $e->setResponseObject($data);
3552
+ break;
3553
+ case 404:
3554
+ $data = ObjectSerializer::deserialize(
3555
+ $e->getResponseBody(),
3556
+ '\SendinBlue\Client\Model\ErrorModel',
3557
+ $e->getResponseHeaders()
3558
+ );
3559
+ $e->setResponseObject($data);
3560
+ break;
3561
+ }
3562
+ throw $e;
3563
+ }
3564
+ }
3565
+
3566
+ /**
3567
+ * Operation updateChildAccountStatusAsync
3568
+ *
3569
+ * Updates infos of reseller's child account status based on the childAuthKey supplied
3570
+ *
3571
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3572
+ * @param \SendinBlue\Client\Model\UpdateChildAccountStatus $updateChildAccountStatus values to update in child account status (required)
3573
+ *
3574
+ * @throws \InvalidArgumentException
3575
+ * @return \GuzzleHttp\Promise\PromiseInterface
3576
+ */
3577
+ public function updateChildAccountStatusAsync($childAuthKey, $updateChildAccountStatus)
3578
+ {
3579
+ return $this->updateChildAccountStatusAsyncWithHttpInfo($childAuthKey, $updateChildAccountStatus)
3580
+ ->then(
3581
+ function ($response) {
3582
+ return $response[0];
3583
+ }
3584
+ );
3585
+ }
3586
+
3587
+ /**
3588
+ * Operation updateChildAccountStatusAsyncWithHttpInfo
3589
+ *
3590
+ * Updates infos of reseller's child account status based on the childAuthKey supplied
3591
+ *
3592
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3593
+ * @param \SendinBlue\Client\Model\UpdateChildAccountStatus $updateChildAccountStatus values to update in child account status (required)
3594
+ *
3595
+ * @throws \InvalidArgumentException
3596
+ * @return \GuzzleHttp\Promise\PromiseInterface
3597
+ */
3598
+ public function updateChildAccountStatusAsyncWithHttpInfo($childAuthKey, $updateChildAccountStatus)
3599
+ {
3600
+ $returnType = '';
3601
+ $request = $this->updateChildAccountStatusRequest($childAuthKey, $updateChildAccountStatus);
3602
+
3603
+ return $this->client
3604
+ ->sendAsync($request, $this->createHttpClientOption())
3605
+ ->then(
3606
+ function ($response) use ($returnType) {
3607
+ return [null, $response->getStatusCode(), $response->getHeaders()];
3608
+ },
3609
+ function ($exception) {
3610
+ $response = $exception->getResponse();
3611
+ $statusCode = $response->getStatusCode();
3612
+ throw new ApiException(
3613
+ sprintf(
3614
+ '[%d] Error connecting to the API (%s)',
3615
+ $statusCode,
3616
+ $exception->getRequest()->getUri()
3617
+ ),
3618
+ $statusCode,
3619
+ $response->getHeaders(),
3620
+ $response->getBody()
3621
+ );
3622
+ }
3623
+ );
3624
+ }
3625
+
3626
+ /**
3627
+ * Create request for operation 'updateChildAccountStatus'
3628
+ *
3629
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3630
+ * @param \SendinBlue\Client\Model\UpdateChildAccountStatus $updateChildAccountStatus values to update in child account status (required)
3631
+ *
3632
+ * @throws \InvalidArgumentException
3633
+ * @return \GuzzleHttp\Psr7\Request
3634
+ */
3635
+ protected function updateChildAccountStatusRequest($childAuthKey, $updateChildAccountStatus)
3636
+ {
3637
+ // verify the required parameter 'childAuthKey' is set
3638
+ if ($childAuthKey === null) {
3639
+ throw new \InvalidArgumentException(
3640
+ 'Missing the required parameter $childAuthKey when calling updateChildAccountStatus'
3641
+ );
3642
+ }
3643
+ // verify the required parameter 'updateChildAccountStatus' is set
3644
+ if ($updateChildAccountStatus === null) {
3645
+ throw new \InvalidArgumentException(
3646
+ 'Missing the required parameter $updateChildAccountStatus when calling updateChildAccountStatus'
3647
+ );
3648
+ }
3649
+
3650
+ $resourcePath = '/reseller/children/{childAuthKey}/accountStatus';
3651
+ $formParams = [];
3652
+ $queryParams = [];
3653
+ $headerParams = [];
3654
+ $httpBody = '';
3655
+ $multipart = false;
3656
+
3657
+
3658
+ // path params
3659
+ if ($childAuthKey !== null) {
3660
+ $resourcePath = str_replace(
3661
+ '{' . 'childAuthKey' . '}',
3662
+ ObjectSerializer::toPathValue($childAuthKey),
3663
+ $resourcePath
3664
+ );
3665
+ }
3666
+
3667
+ // body params
3668
+ $_tempBody = null;
3669
+ if (isset($updateChildAccountStatus)) {
3670
+ $_tempBody = $updateChildAccountStatus;
3671
+ }
3672
+
3673
+ if ($multipart) {
3674
+ $headers = $this->headerSelector->selectHeadersForMultipart(
3675
+ ['application/json']
3676
+ );
3677
+ } else {
3678
+ $headers = $this->headerSelector->selectHeaders(
3679
+ ['application/json'],
3680
+ ['application/json']
3681
+ );
3682
+ }
3683
+
3684
+ // for model (json/xml)
3685
+ if (isset($_tempBody)) {
3686
+ // $_tempBody is the method argument, if present
3687
+ $httpBody = $_tempBody;
3688
+ // \stdClass has no __toString(), so we should encode it manually
3689
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
3690
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
3691
+ }
3692
+ } elseif (count($formParams) > 0) {
3693
+ if ($multipart) {
3694
+ $multipartContents = [];
3695
+ foreach ($formParams as $formParamName => $formParamValue) {
3696
+ $multipartContents[] = [
3697
+ 'name' => $formParamName,
3698
+ 'contents' => $formParamValue
3699
+ ];
3700
+ }
3701
+ // for HTTP post (form)
3702
+ $httpBody = new MultipartStream($multipartContents);
3703
+
3704
+ } elseif ($headers['Content-Type'] === 'application/json') {
3705
+ $httpBody = \GuzzleHttp\json_encode($formParams);
3706
+
3707
+ } else {
3708
+ // for HTTP post (form)
3709
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
3710
+ }
3711
+ }
3712
+
3713
+ // this endpoint requires API key authentication
3714
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
3715
+ if ($apiKey !== null) {
3716
+ $headers['api-key'] = $apiKey;
3717
+ }
3718
+ // this endpoint requires API key authentication
3719
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
3720
+ if ($apiKey !== null) {
3721
+ $headers['partner-key'] = $apiKey;
3722
+ }
3723
+
3724
+ $defaultHeaders = [];
3725
+ if ($this->config->getUserAgent()) {
3726
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
3727
+ }
3728
+
3729
+ $headers = array_merge(
3730
+ $defaultHeaders,
3731
+ $headerParams,
3732
+ $headers
3733
+ );
3734
+
3735
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
3736
+ return new Request(
3737
+ 'PUT',
3738
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
3739
+ $headers,
3740
+ $httpBody
3741
+ );
3742
+ }
3743
+
3744
+ /**
3745
+ * Operation updateChildDomain
3746
+ *
3747
+ * Updates the sender domain of reseller's child based on the childAuthKey and domainName passed
3748
+ *
3749
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3750
+ * @param string $domainName Pass the existing domain that needs to be updated (required)
3751
+ * @param \SendinBlue\Client\Model\UpdateChildDomain $updateChildDomain value to update for sender domain (required)
3752
+ *
3753
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3754
+ * @throws \InvalidArgumentException
3755
+ * @return void
3756
+ */
3757
+ public function updateChildDomain($childAuthKey, $domainName, $updateChildDomain)
3758
+ {
3759
+ $this->updateChildDomainWithHttpInfo($childAuthKey, $domainName, $updateChildDomain);
3760
+ }
3761
+
3762
+ /**
3763
+ * Operation updateChildDomainWithHttpInfo
3764
+ *
3765
+ * Updates the sender domain of reseller's child based on the childAuthKey and domainName passed
3766
+ *
3767
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3768
+ * @param string $domainName Pass the existing domain that needs to be updated (required)
3769
+ * @param \SendinBlue\Client\Model\UpdateChildDomain $updateChildDomain value to update for sender domain (required)
3770
+ *
3771
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
3772
+ * @throws \InvalidArgumentException
3773
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
3774
+ */
3775
+ public function updateChildDomainWithHttpInfo($childAuthKey, $domainName, $updateChildDomain)
3776
+ {
3777
+ $returnType = '';
3778
+ $request = $this->updateChildDomainRequest($childAuthKey, $domainName, $updateChildDomain);
3779
+
3780
+ try {
3781
+ $options = $this->createHttpClientOption();
3782
+ try {
3783
+ $response = $this->client->send($request, $options);
3784
+ } catch (RequestException $e) {
3785
+ throw new ApiException(
3786
+ "[{$e->getCode()}] {$e->getMessage()}",
3787
+ $e->getCode(),
3788
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
3789
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
3790
+ );
3791
+ }
3792
+
3793
+ $statusCode = $response->getStatusCode();
3794
+
3795
+ if ($statusCode < 200 || $statusCode > 299) {
3796
+ throw new ApiException(
3797
+ sprintf(
3798
+ '[%d] Error connecting to the API (%s)',
3799
+ $statusCode,
3800
+ $request->getUri()
3801
+ ),
3802
+ $statusCode,
3803
+ $response->getHeaders(),
3804
+ $response->getBody()
3805
+ );
3806
+ }
3807
+
3808
+ return [null, $statusCode, $response->getHeaders()];
3809
+
3810
+ } catch (ApiException $e) {
3811
+ switch ($e->getCode()) {
3812
+ case 400:
3813
+ $data = ObjectSerializer::deserialize(
3814
+ $e->getResponseBody(),
3815
+ '\SendinBlue\Client\Model\ErrorModel',
3816
+ $e->getResponseHeaders()
3817
+ );
3818
+ $e->setResponseObject($data);
3819
+ break;
3820
+ case 403:
3821
+ $data = ObjectSerializer::deserialize(
3822
+ $e->getResponseBody(),
3823
+ '\SendinBlue\Client\Model\ErrorModel',
3824
+ $e->getResponseHeaders()
3825
+ );
3826
+ $e->setResponseObject($data);
3827
+ break;
3828
+ case 404:
3829
+ $data = ObjectSerializer::deserialize(
3830
+ $e->getResponseBody(),
3831
+ '\SendinBlue\Client\Model\ErrorModel',
3832
+ $e->getResponseHeaders()
3833
+ );
3834
+ $e->setResponseObject($data);
3835
+ break;
3836
+ }
3837
+ throw $e;
3838
+ }
3839
+ }
3840
+
3841
+ /**
3842
+ * Operation updateChildDomainAsync
3843
+ *
3844
+ * Updates the sender domain of reseller's child based on the childAuthKey and domainName passed
3845
+ *
3846
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3847
+ * @param string $domainName Pass the existing domain that needs to be updated (required)
3848
+ * @param \SendinBlue\Client\Model\UpdateChildDomain $updateChildDomain value to update for sender domain (required)
3849
+ *
3850
+ * @throws \InvalidArgumentException
3851
+ * @return \GuzzleHttp\Promise\PromiseInterface
3852
+ */
3853
+ public function updateChildDomainAsync($childAuthKey, $domainName, $updateChildDomain)
3854
+ {
3855
+ return $this->updateChildDomainAsyncWithHttpInfo($childAuthKey, $domainName, $updateChildDomain)
3856
+ ->then(
3857
+ function ($response) {
3858
+ return $response[0];
3859
+ }
3860
+ );
3861
+ }
3862
+
3863
+ /**
3864
+ * Operation updateChildDomainAsyncWithHttpInfo
3865
+ *
3866
+ * Updates the sender domain of reseller's child based on the childAuthKey and domainName passed
3867
+ *
3868
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3869
+ * @param string $domainName Pass the existing domain that needs to be updated (required)
3870
+ * @param \SendinBlue\Client\Model\UpdateChildDomain $updateChildDomain value to update for sender domain (required)
3871
+ *
3872
+ * @throws \InvalidArgumentException
3873
+ * @return \GuzzleHttp\Promise\PromiseInterface
3874
+ */
3875
+ public function updateChildDomainAsyncWithHttpInfo($childAuthKey, $domainName, $updateChildDomain)
3876
+ {
3877
+ $returnType = '';
3878
+ $request = $this->updateChildDomainRequest($childAuthKey, $domainName, $updateChildDomain);
3879
+
3880
+ return $this->client
3881
+ ->sendAsync($request, $this->createHttpClientOption())
3882
+ ->then(
3883
+ function ($response) use ($returnType) {
3884
+ return [null, $response->getStatusCode(), $response->getHeaders()];
3885
+ },
3886
+ function ($exception) {
3887
+ $response = $exception->getResponse();
3888
+ $statusCode = $response->getStatusCode();
3889
+ throw new ApiException(
3890
+ sprintf(
3891
+ '[%d] Error connecting to the API (%s)',
3892
+ $statusCode,
3893
+ $exception->getRequest()->getUri()
3894
+ ),
3895
+ $statusCode,
3896
+ $response->getHeaders(),
3897
+ $response->getBody()
3898
+ );
3899
+ }
3900
+ );
3901
+ }
3902
+
3903
+ /**
3904
+ * Create request for operation 'updateChildDomain'
3905
+ *
3906
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
3907
+ * @param string $domainName Pass the existing domain that needs to be updated (required)
3908
+ * @param \SendinBlue\Client\Model\UpdateChildDomain $updateChildDomain value to update for sender domain (required)
3909
+ *
3910
+ * @throws \InvalidArgumentException
3911
+ * @return \GuzzleHttp\Psr7\Request
3912
+ */
3913
+ protected function updateChildDomainRequest($childAuthKey, $domainName, $updateChildDomain)
3914
+ {
3915
+ // verify the required parameter 'childAuthKey' is set
3916
+ if ($childAuthKey === null) {
3917
+ throw new \InvalidArgumentException(
3918
+ 'Missing the required parameter $childAuthKey when calling updateChildDomain'
3919
+ );
3920
+ }
3921
+ // verify the required parameter 'domainName' is set
3922
+ if ($domainName === null) {
3923
+ throw new \InvalidArgumentException(
3924
+ 'Missing the required parameter $domainName when calling updateChildDomain'
3925
+ );
3926
+ }
3927
+ // verify the required parameter 'updateChildDomain' is set
3928
+ if ($updateChildDomain === null) {
3929
+ throw new \InvalidArgumentException(
3930
+ 'Missing the required parameter $updateChildDomain when calling updateChildDomain'
3931
+ );
3932
+ }
3933
+
3934
+ $resourcePath = '/reseller/children/{childAuthKey}/domains/{domainName}';
3935
+ $formParams = [];
3936
+ $queryParams = [];
3937
+ $headerParams = [];
3938
+ $httpBody = '';
3939
+ $multipart = false;
3940
+
3941
+
3942
+ // path params
3943
+ if ($childAuthKey !== null) {
3944
+ $resourcePath = str_replace(
3945
+ '{' . 'childAuthKey' . '}',
3946
+ ObjectSerializer::toPathValue($childAuthKey),
3947
+ $resourcePath
3948
+ );
3949
+ }
3950
+ // path params
3951
+ if ($domainName !== null) {
3952
+ $resourcePath = str_replace(
3953
+ '{' . 'domainName' . '}',
3954
+ ObjectSerializer::toPathValue($domainName),
3955
+ $resourcePath
3956
+ );
3957
+ }
3958
+
3959
+ // body params
3960
+ $_tempBody = null;
3961
+ if (isset($updateChildDomain)) {
3962
+ $_tempBody = $updateChildDomain;
3963
+ }
3964
+
3965
+ if ($multipart) {
3966
+ $headers = $this->headerSelector->selectHeadersForMultipart(
3967
+ ['application/json']
3968
+ );
3969
+ } else {
3970
+ $headers = $this->headerSelector->selectHeaders(
3971
+ ['application/json'],
3972
+ ['application/json']
3973
+ );
3974
+ }
3975
+
3976
+ // for model (json/xml)
3977
+ if (isset($_tempBody)) {
3978
+ // $_tempBody is the method argument, if present
3979
+ $httpBody = $_tempBody;
3980
+ // \stdClass has no __toString(), so we should encode it manually
3981
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
3982
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
3983
+ }
3984
+ } elseif (count($formParams) > 0) {
3985
+ if ($multipart) {
3986
+ $multipartContents = [];
3987
+ foreach ($formParams as $formParamName => $formParamValue) {
3988
+ $multipartContents[] = [
3989
+ 'name' => $formParamName,
3990
+ 'contents' => $formParamValue
3991
+ ];
3992
+ }
3993
+ // for HTTP post (form)
3994
+ $httpBody = new MultipartStream($multipartContents);
3995
+
3996
+ } elseif ($headers['Content-Type'] === 'application/json') {
3997
+ $httpBody = \GuzzleHttp\json_encode($formParams);
3998
+
3999
+ } else {
4000
+ // for HTTP post (form)
4001
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
4002
+ }
4003
+ }
4004
+
4005
+ // this endpoint requires API key authentication
4006
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
4007
+ if ($apiKey !== null) {
4008
+ $headers['api-key'] = $apiKey;
4009
+ }
4010
+ // this endpoint requires API key authentication
4011
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
4012
+ if ($apiKey !== null) {
4013
+ $headers['partner-key'] = $apiKey;
4014
+ }
4015
+
4016
+ $defaultHeaders = [];
4017
+ if ($this->config->getUserAgent()) {
4018
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
4019
+ }
4020
+
4021
+ $headers = array_merge(
4022
+ $defaultHeaders,
4023
+ $headerParams,
4024
+ $headers
4025
+ );
4026
+
4027
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
4028
+ return new Request(
4029
+ 'PUT',
4030
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
4031
+ $headers,
4032
+ $httpBody
4033
+ );
4034
+ }
4035
+
4036
+ /**
4037
+ * Operation updateResellerChild
4038
+ *
4039
+ * Updates infos of reseller's child based on the childAuthKey supplied
4040
+ *
4041
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
4042
+ * @param \SendinBlue\Client\Model\UpdateChild $resellerChild values to update in child profile (required)
4043
+ *
4044
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
4045
+ * @throws \InvalidArgumentException
4046
+ * @return void
4047
+ */
4048
+ public function updateResellerChild($childAuthKey, $resellerChild)
4049
+ {
4050
+ $this->updateResellerChildWithHttpInfo($childAuthKey, $resellerChild);
4051
+ }
4052
+
4053
+ /**
4054
+ * Operation updateResellerChildWithHttpInfo
4055
+ *
4056
+ * Updates infos of reseller's child based on the childAuthKey supplied
4057
+ *
4058
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
4059
+ * @param \SendinBlue\Client\Model\UpdateChild $resellerChild values to update in child profile (required)
4060
+ *
4061
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
4062
+ * @throws \InvalidArgumentException
4063
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
4064
+ */
4065
+ public function updateResellerChildWithHttpInfo($childAuthKey, $resellerChild)
4066
+ {
4067
+ $returnType = '';
4068
+ $request = $this->updateResellerChildRequest($childAuthKey, $resellerChild);
4069
+
4070
+ try {
4071
+ $options = $this->createHttpClientOption();
4072
+ try {
4073
+ $response = $this->client->send($request, $options);
4074
+ } catch (RequestException $e) {
4075
+ throw new ApiException(
4076
+ "[{$e->getCode()}] {$e->getMessage()}",
4077
+ $e->getCode(),
4078
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
4079
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
4080
+ );
4081
+ }
4082
+
4083
+ $statusCode = $response->getStatusCode();
4084
+
4085
+ if ($statusCode < 200 || $statusCode > 299) {
4086
+ throw new ApiException(
4087
+ sprintf(
4088
+ '[%d] Error connecting to the API (%s)',
4089
+ $statusCode,
4090
+ $request->getUri()
4091
+ ),
4092
+ $statusCode,
4093
+ $response->getHeaders(),
4094
+ $response->getBody()
4095
+ );
4096
+ }
4097
+
4098
+ return [null, $statusCode, $response->getHeaders()];
4099
+
4100
+ } catch (ApiException $e) {
4101
+ switch ($e->getCode()) {
4102
+ case 400:
4103
+ $data = ObjectSerializer::deserialize(
4104
+ $e->getResponseBody(),
4105
+ '\SendinBlue\Client\Model\ErrorModel',
4106
+ $e->getResponseHeaders()
4107
+ );
4108
+ $e->setResponseObject($data);
4109
+ break;
4110
+ case 403:
4111
+ $data = ObjectSerializer::deserialize(
4112
+ $e->getResponseBody(),
4113
+ '\SendinBlue\Client\Model\ErrorModel',
4114
+ $e->getResponseHeaders()
4115
+ );
4116
+ $e->setResponseObject($data);
4117
+ break;
4118
+ case 404:
4119
+ $data = ObjectSerializer::deserialize(
4120
+ $e->getResponseBody(),
4121
+ '\SendinBlue\Client\Model\ErrorModel',
4122
+ $e->getResponseHeaders()
4123
+ );
4124
+ $e->setResponseObject($data);
4125
+ break;
4126
+ }
4127
+ throw $e;
4128
+ }
4129
+ }
4130
+
4131
+ /**
4132
+ * Operation updateResellerChildAsync
4133
+ *
4134
+ * Updates infos of reseller's child based on the childAuthKey supplied
4135
+ *
4136
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
4137
+ * @param \SendinBlue\Client\Model\UpdateChild $resellerChild values to update in child profile (required)
4138
+ *
4139
+ * @throws \InvalidArgumentException
4140
+ * @return \GuzzleHttp\Promise\PromiseInterface
4141
+ */
4142
+ public function updateResellerChildAsync($childAuthKey, $resellerChild)
4143
+ {
4144
+ return $this->updateResellerChildAsyncWithHttpInfo($childAuthKey, $resellerChild)
4145
+ ->then(
4146
+ function ($response) {
4147
+ return $response[0];
4148
+ }
4149
+ );
4150
+ }
4151
+
4152
+ /**
4153
+ * Operation updateResellerChildAsyncWithHttpInfo
4154
+ *
4155
+ * Updates infos of reseller's child based on the childAuthKey supplied
4156
+ *
4157
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
4158
+ * @param \SendinBlue\Client\Model\UpdateChild $resellerChild values to update in child profile (required)
4159
+ *
4160
+ * @throws \InvalidArgumentException
4161
+ * @return \GuzzleHttp\Promise\PromiseInterface
4162
+ */
4163
+ public function updateResellerChildAsyncWithHttpInfo($childAuthKey, $resellerChild)
4164
+ {
4165
+ $returnType = '';
4166
+ $request = $this->updateResellerChildRequest($childAuthKey, $resellerChild);
4167
+
4168
+ return $this->client
4169
+ ->sendAsync($request, $this->createHttpClientOption())
4170
+ ->then(
4171
+ function ($response) use ($returnType) {
4172
+ return [null, $response->getStatusCode(), $response->getHeaders()];
4173
+ },
4174
+ function ($exception) {
4175
+ $response = $exception->getResponse();
4176
+ $statusCode = $response->getStatusCode();
4177
+ throw new ApiException(
4178
+ sprintf(
4179
+ '[%d] Error connecting to the API (%s)',
4180
+ $statusCode,
4181
+ $exception->getRequest()->getUri()
4182
+ ),
4183
+ $statusCode,
4184
+ $response->getHeaders(),
4185
+ $response->getBody()
4186
+ );
4187
+ }
4188
+ );
4189
+ }
4190
+
4191
+ /**
4192
+ * Create request for operation 'updateResellerChild'
4193
+ *
4194
+ * @param string $childAuthKey auth key of reseller&#39;s child (required)
4195
+ * @param \SendinBlue\Client\Model\UpdateChild $resellerChild values to update in child profile (required)
4196
+ *
4197
+ * @throws \InvalidArgumentException
4198
+ * @return \GuzzleHttp\Psr7\Request
4199
+ */
4200
+ protected function updateResellerChildRequest($childAuthKey, $resellerChild)
4201
+ {
4202
+ // verify the required parameter 'childAuthKey' is set
4203
+ if ($childAuthKey === null) {
4204
+ throw new \InvalidArgumentException(
4205
+ 'Missing the required parameter $childAuthKey when calling updateResellerChild'
4206
+ );
4207
+ }
4208
+ // verify the required parameter 'resellerChild' is set
4209
+ if ($resellerChild === null) {
4210
+ throw new \InvalidArgumentException(
4211
+ 'Missing the required parameter $resellerChild when calling updateResellerChild'
4212
+ );
4213
+ }
4214
+
4215
+ $resourcePath = '/reseller/children/{childAuthKey}';
4216
+ $formParams = [];
4217
+ $queryParams = [];
4218
+ $headerParams = [];
4219
+ $httpBody = '';
4220
+ $multipart = false;
4221
+
4222
+
4223
+ // path params
4224
+ if ($childAuthKey !== null) {
4225
+ $resourcePath = str_replace(
4226
+ '{' . 'childAuthKey' . '}',
4227
+ ObjectSerializer::toPathValue($childAuthKey),
4228
+ $resourcePath
4229
+ );
4230
+ }
4231
+
4232
+ // body params
4233
+ $_tempBody = null;
4234
+ if (isset($resellerChild)) {
4235
+ $_tempBody = $resellerChild;
4236
+ }
4237
+
4238
+ if ($multipart) {
4239
+ $headers = $this->headerSelector->selectHeadersForMultipart(
4240
+ ['application/json']
4241
+ );
4242
+ } else {
4243
+ $headers = $this->headerSelector->selectHeaders(
4244
+ ['application/json'],
4245
+ ['application/json']
4246
+ );
4247
+ }
4248
+
4249
+ // for model (json/xml)
4250
+ if (isset($_tempBody)) {
4251
+ // $_tempBody is the method argument, if present
4252
+ $httpBody = $_tempBody;
4253
+ // \stdClass has no __toString(), so we should encode it manually
4254
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
4255
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
4256
+ }
4257
+ } elseif (count($formParams) > 0) {
4258
+ if ($multipart) {
4259
+ $multipartContents = [];
4260
+ foreach ($formParams as $formParamName => $formParamValue) {
4261
+ $multipartContents[] = [
4262
+ 'name' => $formParamName,
4263
+ 'contents' => $formParamValue
4264
+ ];
4265
+ }
4266
+ // for HTTP post (form)
4267
+ $httpBody = new MultipartStream($multipartContents);
4268
+
4269
+ } elseif ($headers['Content-Type'] === 'application/json') {
4270
+ $httpBody = \GuzzleHttp\json_encode($formParams);
4271
+
4272
+ } else {
4273
+ // for HTTP post (form)
4274
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
4275
+ }
4276
+ }
4277
+
4278
+ // this endpoint requires API key authentication
4279
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
4280
+ if ($apiKey !== null) {
4281
+ $headers['api-key'] = $apiKey;
4282
+ }
4283
+ // this endpoint requires API key authentication
4284
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
4285
+ if ($apiKey !== null) {
4286
+ $headers['partner-key'] = $apiKey;
4287
+ }
4288
+
4289
+ $defaultHeaders = [];
4290
+ if ($this->config->getUserAgent()) {
4291
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
4292
+ }
4293
+
4294
+ $headers = array_merge(
4295
+ $defaultHeaders,
4296
+ $headerParams,
4297
+ $headers
4298
+ );
4299
+
4300
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
4301
+ return new Request(
4302
+ 'PUT',
4303
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
4304
+ $headers,
4305
+ $httpBody
4306
+ );
4307
+ }
4308
+
4309
+ /**
4310
+ * Create http client option
4311
+ *
4312
+ * @throws \RuntimeException on file opening failure
4313
+ * @return array of http client options
4314
+ */
4315
+ protected function createHttpClientOption()
4316
+ {
4317
+ $options = [];
4318
+ if ($this->config->getDebug()) {
4319
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
4320
+ if (!$options[RequestOptions::DEBUG]) {
4321
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
4322
+ }
4323
+ }
4324
+
4325
+ return $options;
4326
+ }
4327
+ }
vendor/sendinblue/api-v3-sdk/lib/Api/SMSCampaignsApi.php ADDED
@@ -0,0 +1,2842 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SMSCampaignsApi
4
+ * PHP version 5
5
+ *
6
+ * @category Class
7
+ * @package SendinBlue\Client
8
+ * @author Swagger Codegen team
9
+ * @link https://github.com/swagger-api/swagger-codegen
10
+ */
11
+
12
+ /**
13
+ * SendinBlue API
14
+ *
15
+ * SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
16
+ *
17
+ * OpenAPI spec version: 3.0.0
18
+ * Contact: contact@sendinblue.com
19
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
20
+ * Swagger Codegen version: 2.3.1
21
+ */
22
+
23
+ /**
24
+ * NOTE: This class is auto generated by the swagger code generator program.
25
+ * https://github.com/swagger-api/swagger-codegen
26
+ * Do not edit the class manually.
27
+ */
28
+
29
+ namespace SendinBlue\Client\Api;
30
+
31
+ use GuzzleHttp\Client;
32
+ use GuzzleHttp\ClientInterface;
33
+ use GuzzleHttp\Exception\RequestException;
34
+ use GuzzleHttp\Psr7\MultipartStream;
35
+ use GuzzleHttp\Psr7\Request;
36
+ use GuzzleHttp\RequestOptions;
37
+ use SendinBlue\Client\ApiException;
38
+ use SendinBlue\Client\Configuration;
39
+ use SendinBlue\Client\HeaderSelector;
40
+ use SendinBlue\Client\ObjectSerializer;
41
+
42
+ /**
43
+ * SMSCampaignsApi Class Doc Comment
44
+ *
45
+ * @category Class
46
+ * @package SendinBlue\Client
47
+ * @author Swagger Codegen team
48
+ * @link https://github.com/swagger-api/swagger-codegen
49
+ */
50
+ class SMSCampaignsApi
51
+ {
52
+ /**
53
+ * @var ClientInterface
54
+ */
55
+ protected $client;
56
+
57
+ /**
58
+ * @var Configuration
59
+ */
60
+ protected $config;
61
+
62
+ /**
63
+ * @param ClientInterface $client
64
+ * @param Configuration $config
65
+ * @param HeaderSelector $selector
66
+ */
67
+ public function __construct(
68
+ ClientInterface $client = null,
69
+ Configuration $config = null,
70
+ HeaderSelector $selector = null
71
+ ) {
72
+ $this->client = $client ?: new Client();
73
+ $this->config = $config ?: new Configuration();
74
+ $this->headerSelector = $selector ?: new HeaderSelector();
75
+ }
76
+
77
+ /**
78
+ * @return Configuration
79
+ */
80
+ public function getConfig()
81
+ {
82
+ return $this->config;
83
+ }
84
+
85
+ /**
86
+ * Operation createSmsCampaign
87
+ *
88
+ * Creates an SMS campaign
89
+ *
90
+ * @param \SendinBlue\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required)
91
+ *
92
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
93
+ * @throws \InvalidArgumentException
94
+ * @return \SendinBlue\Client\Model\CreateModel
95
+ */
96
+ public function createSmsCampaign($createSmsCampaign)
97
+ {
98
+ list($response) = $this->createSmsCampaignWithHttpInfo($createSmsCampaign);
99
+ return $response;
100
+ }
101
+
102
+ /**
103
+ * Operation createSmsCampaignWithHttpInfo
104
+ *
105
+ * Creates an SMS campaign
106
+ *
107
+ * @param \SendinBlue\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required)
108
+ *
109
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
110
+ * @throws \InvalidArgumentException
111
+ * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings)
112
+ */
113
+ public function createSmsCampaignWithHttpInfo($createSmsCampaign)
114
+ {
115
+ $returnType = '\SendinBlue\Client\Model\CreateModel';
116
+ $request = $this->createSmsCampaignRequest($createSmsCampaign);
117
+
118
+ try {
119
+ $options = $this->createHttpClientOption();
120
+ try {
121
+ $response = $this->client->send($request, $options);
122
+ } catch (RequestException $e) {
123
+ throw new ApiException(
124
+ "[{$e->getCode()}] {$e->getMessage()}",
125
+ $e->getCode(),
126
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
127
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
128
+ );
129
+ }
130
+
131
+ $statusCode = $response->getStatusCode();
132
+
133
+ if ($statusCode < 200 || $statusCode > 299) {
134
+ throw new ApiException(
135
+ sprintf(
136
+ '[%d] Error connecting to the API (%s)',
137
+ $statusCode,
138
+ $request->getUri()
139
+ ),
140
+ $statusCode,
141
+ $response->getHeaders(),
142
+ $response->getBody()
143
+ );
144
+ }
145
+
146
+ $responseBody = $response->getBody();
147
+ if ($returnType === '\SplFileObject') {
148
+ $content = $responseBody; //stream goes to serializer
149
+ } else {
150
+ $content = $responseBody->getContents();
151
+ if ($returnType !== 'string') {
152
+ $content = json_decode($content);
153
+ }
154
+ }
155
+
156
+ return [
157
+ ObjectSerializer::deserialize($content, $returnType, []),
158
+ $response->getStatusCode(),
159
+ $response->getHeaders()
160
+ ];
161
+
162
+ } catch (ApiException $e) {
163
+ switch ($e->getCode()) {
164
+ case 201:
165
+ $data = ObjectSerializer::deserialize(
166
+ $e->getResponseBody(),
167
+ '\SendinBlue\Client\Model\CreateModel',
168
+ $e->getResponseHeaders()
169
+ );
170
+ $e->setResponseObject($data);
171
+ break;
172
+ case 400:
173
+ $data = ObjectSerializer::deserialize(
174
+ $e->getResponseBody(),
175
+ '\SendinBlue\Client\Model\ErrorModel',
176
+ $e->getResponseHeaders()
177
+ );
178
+ $e->setResponseObject($data);
179
+ break;
180
+ }
181
+ throw $e;
182
+ }
183
+ }
184
+
185
+ /**
186
+ * Operation createSmsCampaignAsync
187
+ *
188
+ * Creates an SMS campaign
189
+ *
190
+ * @param \SendinBlue\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required)
191
+ *
192
+ * @throws \InvalidArgumentException
193
+ * @return \GuzzleHttp\Promise\PromiseInterface
194
+ */
195
+ public function createSmsCampaignAsync($createSmsCampaign)
196
+ {
197
+ return $this->createSmsCampaignAsyncWithHttpInfo($createSmsCampaign)
198
+ ->then(
199
+ function ($response) {
200
+ return $response[0];
201
+ }
202
+ );
203
+ }
204
+
205
+ /**
206
+ * Operation createSmsCampaignAsyncWithHttpInfo
207
+ *
208
+ * Creates an SMS campaign
209
+ *
210
+ * @param \SendinBlue\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required)
211
+ *
212
+ * @throws \InvalidArgumentException
213
+ * @return \GuzzleHttp\Promise\PromiseInterface
214
+ */
215
+ public function createSmsCampaignAsyncWithHttpInfo($createSmsCampaign)
216
+ {
217
+ $returnType = '\SendinBlue\Client\Model\CreateModel';
218
+ $request = $this->createSmsCampaignRequest($createSmsCampaign);
219
+
220
+ return $this->client
221
+ ->sendAsync($request, $this->createHttpClientOption())
222
+ ->then(
223
+ function ($response) use ($returnType) {
224
+ $responseBody = $response->getBody();
225
+ if ($returnType === '\SplFileObject') {
226
+ $content = $responseBody; //stream goes to serializer
227
+ } else {
228
+ $content = $responseBody->getContents();
229
+ if ($returnType !== 'string') {
230
+ $content = json_decode($content);
231
+ }
232
+ }
233
+
234
+ return [
235
+ ObjectSerializer::deserialize($content, $returnType, []),
236
+ $response->getStatusCode(),
237
+ $response->getHeaders()
238
+ ];
239
+ },
240
+ function ($exception) {
241
+ $response = $exception->getResponse();
242
+ $statusCode = $response->getStatusCode();
243
+ throw new ApiException(
244
+ sprintf(
245
+ '[%d] Error connecting to the API (%s)',
246
+ $statusCode,
247
+ $exception->getRequest()->getUri()
248
+ ),
249
+ $statusCode,
250
+ $response->getHeaders(),
251
+ $response->getBody()
252
+ );
253
+ }
254
+ );
255
+ }
256
+
257
+ /**
258
+ * Create request for operation 'createSmsCampaign'
259
+ *
260
+ * @param \SendinBlue\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required)
261
+ *
262
+ * @throws \InvalidArgumentException
263
+ * @return \GuzzleHttp\Psr7\Request
264
+ */
265
+ protected function createSmsCampaignRequest($createSmsCampaign)
266
+ {
267
+ // verify the required parameter 'createSmsCampaign' is set
268
+ if ($createSmsCampaign === null) {
269
+ throw new \InvalidArgumentException(
270
+ 'Missing the required parameter $createSmsCampaign when calling createSmsCampaign'
271
+ );
272
+ }
273
+
274
+ $resourcePath = '/smsCampaigns';
275
+ $formParams = [];
276
+ $queryParams = [];
277
+ $headerParams = [];
278
+ $httpBody = '';
279
+ $multipart = false;
280
+
281
+
282
+
283
+ // body params
284
+ $_tempBody = null;
285
+ if (isset($createSmsCampaign)) {
286
+ $_tempBody = $createSmsCampaign;
287
+ }
288
+
289
+ if ($multipart) {
290
+ $headers = $this->headerSelector->selectHeadersForMultipart(
291
+ ['application/json']
292
+ );
293
+ } else {
294
+ $headers = $this->headerSelector->selectHeaders(
295
+ ['application/json'],
296
+ ['application/json']
297
+ );
298
+ }
299
+
300
+ // for model (json/xml)
301
+ if (isset($_tempBody)) {
302
+ // $_tempBody is the method argument, if present
303
+ $httpBody = $_tempBody;
304
+ // \stdClass has no __toString(), so we should encode it manually
305
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
306
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
307
+ }
308
+ } elseif (count($formParams) > 0) {
309
+ if ($multipart) {
310
+ $multipartContents = [];
311
+ foreach ($formParams as $formParamName => $formParamValue) {
312
+ $multipartContents[] = [
313
+ 'name' => $formParamName,
314
+ 'contents' => $formParamValue
315
+ ];
316
+ }
317
+ // for HTTP post (form)
318
+ $httpBody = new MultipartStream($multipartContents);
319
+
320
+ } elseif ($headers['Content-Type'] === 'application/json') {
321
+ $httpBody = \GuzzleHttp\json_encode($formParams);
322
+
323
+ } else {
324
+ // for HTTP post (form)
325
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
326
+ }
327
+ }
328
+
329
+ // this endpoint requires API key authentication
330
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
331
+ if ($apiKey !== null) {
332
+ $headers['api-key'] = $apiKey;
333
+ }
334
+ // this endpoint requires API key authentication
335
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
336
+ if ($apiKey !== null) {
337
+ $headers['partner-key'] = $apiKey;
338
+ }
339
+
340
+ $defaultHeaders = [];
341
+ if ($this->config->getUserAgent()) {
342
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
343
+ }
344
+
345
+ $headers = array_merge(
346
+ $defaultHeaders,
347
+ $headerParams,
348
+ $headers
349
+ );
350
+
351
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
352
+ return new Request(
353
+ 'POST',
354
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
355
+ $headers,
356
+ $httpBody
357
+ );
358
+ }
359
+
360
+ /**
361
+ * Operation deleteSmsCampaign
362
+ *
363
+ * Delete the SMS campaign
364
+ *
365
+ * @param int $campaignId id of the SMS campaign (required)
366
+ *
367
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
368
+ * @throws \InvalidArgumentException
369
+ * @return void
370
+ */
371
+ public function deleteSmsCampaign($campaignId)
372
+ {
373
+ $this->deleteSmsCampaignWithHttpInfo($campaignId);
374
+ }
375
+
376
+ /**
377
+ * Operation deleteSmsCampaignWithHttpInfo
378
+ *
379
+ * Delete the SMS campaign
380
+ *
381
+ * @param int $campaignId id of the SMS campaign (required)
382
+ *
383
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
384
+ * @throws \InvalidArgumentException
385
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
386
+ */
387
+ public function deleteSmsCampaignWithHttpInfo($campaignId)
388
+ {
389
+ $returnType = '';
390
+ $request = $this->deleteSmsCampaignRequest($campaignId);
391
+
392
+ try {
393
+ $options = $this->createHttpClientOption();
394
+ try {
395
+ $response = $this->client->send($request, $options);
396
+ } catch (RequestException $e) {
397
+ throw new ApiException(
398
+ "[{$e->getCode()}] {$e->getMessage()}",
399
+ $e->getCode(),
400
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
401
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
402
+ );
403
+ }
404
+
405
+ $statusCode = $response->getStatusCode();
406
+
407
+ if ($statusCode < 200 || $statusCode > 299) {
408
+ throw new ApiException(
409
+ sprintf(
410
+ '[%d] Error connecting to the API (%s)',
411
+ $statusCode,
412
+ $request->getUri()
413
+ ),
414
+ $statusCode,
415
+ $response->getHeaders(),
416
+ $response->getBody()
417
+ );
418
+ }
419
+
420
+ return [null, $statusCode, $response->getHeaders()];
421
+
422
+ } catch (ApiException $e) {
423
+ switch ($e->getCode()) {
424
+ case 400:
425
+ $data = ObjectSerializer::deserialize(
426
+ $e->getResponseBody(),
427
+ '\SendinBlue\Client\Model\ErrorModel',
428
+ $e->getResponseHeaders()
429
+ );
430
+ $e->setResponseObject($data);
431
+ break;
432
+ case 404:
433
+ $data = ObjectSerializer::deserialize(
434
+ $e->getResponseBody(),
435
+ '\SendinBlue\Client\Model\ErrorModel',
436
+ $e->getResponseHeaders()
437
+ );
438
+ $e->setResponseObject($data);
439
+ break;
440
+ }
441
+ throw $e;
442
+ }
443
+ }
444
+
445
+ /**
446
+ * Operation deleteSmsCampaignAsync
447
+ *
448
+ * Delete the SMS campaign
449
+ *
450
+ * @param int $campaignId id of the SMS campaign (required)
451
+ *
452
+ * @throws \InvalidArgumentException
453
+ * @return \GuzzleHttp\Promise\PromiseInterface
454
+ */
455
+ public function deleteSmsCampaignAsync($campaignId)
456
+ {
457
+ return $this->deleteSmsCampaignAsyncWithHttpInfo($campaignId)
458
+ ->then(
459
+ function ($response) {
460
+ return $response[0];
461
+ }
462
+ );
463
+ }
464
+
465
+ /**
466
+ * Operation deleteSmsCampaignAsyncWithHttpInfo
467
+ *
468
+ * Delete the SMS campaign
469
+ *
470
+ * @param int $campaignId id of the SMS campaign (required)
471
+ *
472
+ * @throws \InvalidArgumentException
473
+ * @return \GuzzleHttp\Promise\PromiseInterface
474
+ */
475
+ public function deleteSmsCampaignAsyncWithHttpInfo($campaignId)
476
+ {
477
+ $returnType = '';
478
+ $request = $this->deleteSmsCampaignRequest($campaignId);
479
+
480
+ return $this->client
481
+ ->sendAsync($request, $this->createHttpClientOption())
482
+ ->then(
483
+ function ($response) use ($returnType) {
484
+ return [null, $response->getStatusCode(), $response->getHeaders()];
485
+ },
486
+ function ($exception) {
487
+ $response = $exception->getResponse();
488
+ $statusCode = $response->getStatusCode();
489
+ throw new ApiException(
490
+ sprintf(
491
+ '[%d] Error connecting to the API (%s)',
492
+ $statusCode,
493
+ $exception->getRequest()->getUri()
494
+ ),
495
+ $statusCode,
496
+ $response->getHeaders(),
497
+ $response->getBody()
498
+ );
499
+ }
500
+ );
501
+ }
502
+
503
+ /**
504
+ * Create request for operation 'deleteSmsCampaign'
505
+ *
506
+ * @param int $campaignId id of the SMS campaign (required)
507
+ *
508
+ * @throws \InvalidArgumentException
509
+ * @return \GuzzleHttp\Psr7\Request
510
+ */
511
+ protected function deleteSmsCampaignRequest($campaignId)
512
+ {
513
+ // verify the required parameter 'campaignId' is set
514
+ if ($campaignId === null) {
515
+ throw new \InvalidArgumentException(
516
+ 'Missing the required parameter $campaignId when calling deleteSmsCampaign'
517
+ );
518
+ }
519
+
520
+ $resourcePath = '/smsCampaigns/{campaignId}';
521
+ $formParams = [];
522
+ $queryParams = [];
523
+ $headerParams = [];
524
+ $httpBody = '';
525
+ $multipart = false;
526
+
527
+
528
+ // path params
529
+ if ($campaignId !== null) {
530
+ $resourcePath = str_replace(
531
+ '{' . 'campaignId' . '}',
532
+ ObjectSerializer::toPathValue($campaignId),
533
+ $resourcePath
534
+ );
535
+ }
536
+
537
+ // body params
538
+ $_tempBody = null;
539
+
540
+ if ($multipart) {
541
+ $headers = $this->headerSelector->selectHeadersForMultipart(
542
+ ['application/json']
543
+ );
544
+ } else {
545
+ $headers = $this->headerSelector->selectHeaders(
546
+ ['application/json'],
547
+ ['application/json']
548
+ );
549
+ }
550
+
551
+ // for model (json/xml)
552
+ if (isset($_tempBody)) {
553
+ // $_tempBody is the method argument, if present
554
+ $httpBody = $_tempBody;
555
+ // \stdClass has no __toString(), so we should encode it manually
556
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
557
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
558
+ }
559
+ } elseif (count($formParams) > 0) {
560
+ if ($multipart) {
561
+ $multipartContents = [];
562
+ foreach ($formParams as $formParamName => $formParamValue) {
563
+ $multipartContents[] = [
564
+ 'name' => $formParamName,
565
+ 'contents' => $formParamValue
566
+ ];
567
+ }
568
+ // for HTTP post (form)
569
+ $httpBody = new MultipartStream($multipartContents);
570
+
571
+ } elseif ($headers['Content-Type'] === 'application/json') {
572
+ $httpBody = \GuzzleHttp\json_encode($formParams);
573
+
574
+ } else {
575
+ // for HTTP post (form)
576
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
577
+ }
578
+ }
579
+
580
+ // this endpoint requires API key authentication
581
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
582
+ if ($apiKey !== null) {
583
+ $headers['api-key'] = $apiKey;
584
+ }
585
+ // this endpoint requires API key authentication
586
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
587
+ if ($apiKey !== null) {
588
+ $headers['partner-key'] = $apiKey;
589
+ }
590
+
591
+ $defaultHeaders = [];
592
+ if ($this->config->getUserAgent()) {
593
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
594
+ }
595
+
596
+ $headers = array_merge(
597
+ $defaultHeaders,
598
+ $headerParams,
599
+ $headers
600
+ );
601
+
602
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
603
+ return new Request(
604
+ 'DELETE',
605
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
606
+ $headers,
607
+ $httpBody
608
+ );
609
+ }
610
+
611
+ /**
612
+ * Operation getSmsCampaign
613
+ *
614
+ * Get an SMS campaign
615
+ *
616
+ * @param int $campaignId id of the SMS campaign (required)
617
+ *
618
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
619
+ * @throws \InvalidArgumentException
620
+ * @return \SendinBlue\Client\Model\GetSmsCampaign
621
+ */
622
+ public function getSmsCampaign($campaignId)
623
+ {
624
+ list($response) = $this->getSmsCampaignWithHttpInfo($campaignId);
625
+ return $response;
626
+ }
627
+
628
+ /**
629
+ * Operation getSmsCampaignWithHttpInfo
630
+ *
631
+ * Get an SMS campaign
632
+ *
633
+ * @param int $campaignId id of the SMS campaign (required)
634
+ *
635
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
636
+ * @throws \InvalidArgumentException
637
+ * @return array of \SendinBlue\Client\Model\GetSmsCampaign, HTTP status code, HTTP response headers (array of strings)
638
+ */
639
+ public function getSmsCampaignWithHttpInfo($campaignId)
640
+ {
641
+ $returnType = '\SendinBlue\Client\Model\GetSmsCampaign';
642
+ $request = $this->getSmsCampaignRequest($campaignId);
643
+
644
+ try {
645
+ $options = $this->createHttpClientOption();
646
+ try {
647
+ $response = $this->client->send($request, $options);
648
+ } catch (RequestException $e) {
649
+ throw new ApiException(
650
+ "[{$e->getCode()}] {$e->getMessage()}",
651
+ $e->getCode(),
652
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
653
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
654
+ );
655
+ }
656
+
657
+ $statusCode = $response->getStatusCode();
658
+
659
+ if ($statusCode < 200 || $statusCode > 299) {
660
+ throw new ApiException(
661
+ sprintf(
662
+ '[%d] Error connecting to the API (%s)',
663
+ $statusCode,
664
+ $request->getUri()
665
+ ),
666
+ $statusCode,
667
+ $response->getHeaders(),
668
+ $response->getBody()
669
+ );
670
+ }
671
+
672
+ $responseBody = $response->getBody();
673
+ if ($returnType === '\SplFileObject') {
674
+ $content = $responseBody; //stream goes to serializer
675
+ } else {
676
+ $content = $responseBody->getContents();
677
+ if ($returnType !== 'string') {
678
+ $content = json_decode($content);
679
+ }
680
+ }
681
+
682
+ return [
683
+ ObjectSerializer::deserialize($content, $returnType, []),
684
+ $response->getStatusCode(),
685
+ $response->getHeaders()
686
+ ];
687
+
688
+ } catch (ApiException $e) {
689
+ switch ($e->getCode()) {
690
+ case 200:
691
+ $data = ObjectSerializer::deserialize(
692
+ $e->getResponseBody(),
693
+ '\SendinBlue\Client\Model\GetSmsCampaign',
694
+ $e->getResponseHeaders()
695
+ );
696
+ $e->setResponseObject($data);
697
+ break;
698
+ case 400:
699
+ $data = ObjectSerializer::deserialize(
700
+ $e->getResponseBody(),
701
+ '\SendinBlue\Client\Model\ErrorModel',
702
+ $e->getResponseHeaders()
703
+ );
704
+ $e->setResponseObject($data);
705
+ break;
706
+ case 404:
707
+ $data = ObjectSerializer::deserialize(
708
+ $e->getResponseBody(),
709
+ '\SendinBlue\Client\Model\ErrorModel',
710
+ $e->getResponseHeaders()
711
+ );
712
+ $e->setResponseObject($data);
713
+ break;
714
+ }
715
+ throw $e;
716
+ }
717
+ }
718
+
719
+ /**
720
+ * Operation getSmsCampaignAsync
721
+ *
722
+ * Get an SMS campaign
723
+ *
724
+ * @param int $campaignId id of the SMS campaign (required)
725
+ *
726
+ * @throws \InvalidArgumentException
727
+ * @return \GuzzleHttp\Promise\PromiseInterface
728
+ */
729
+ public function getSmsCampaignAsync($campaignId)
730
+ {
731
+ return $this->getSmsCampaignAsyncWithHttpInfo($campaignId)
732
+ ->then(
733
+ function ($response) {
734
+ return $response[0];
735
+ }
736
+ );
737
+ }
738
+
739
+ /**
740
+ * Operation getSmsCampaignAsyncWithHttpInfo
741
+ *
742
+ * Get an SMS campaign
743
+ *
744
+ * @param int $campaignId id of the SMS campaign (required)
745
+ *
746
+ * @throws \InvalidArgumentException
747
+ * @return \GuzzleHttp\Promise\PromiseInterface
748
+ */
749
+ public function getSmsCampaignAsyncWithHttpInfo($campaignId)
750
+ {
751
+ $returnType = '\SendinBlue\Client\Model\GetSmsCampaign';
752
+ $request = $this->getSmsCampaignRequest($campaignId);
753
+
754
+ return $this->client
755
+ ->sendAsync($request, $this->createHttpClientOption())
756
+ ->then(
757
+ function ($response) use ($returnType) {
758
+ $responseBody = $response->getBody();
759
+ if ($returnType === '\SplFileObject') {
760
+ $content = $responseBody; //stream goes to serializer
761
+ } else {
762
+ $content = $responseBody->getContents();
763
+ if ($returnType !== 'string') {
764
+ $content = json_decode($content);
765
+ }
766
+ }
767
+
768
+ return [
769
+ ObjectSerializer::deserialize($content, $returnType, []),
770
+ $response->getStatusCode(),
771
+ $response->getHeaders()
772
+ ];
773
+ },
774
+ function ($exception) {
775
+ $response = $exception->getResponse();
776
+ $statusCode = $response->getStatusCode();
777
+ throw new ApiException(
778
+ sprintf(
779
+ '[%d] Error connecting to the API (%s)',
780
+ $statusCode,
781
+ $exception->getRequest()->getUri()
782
+ ),
783
+ $statusCode,
784
+ $response->getHeaders(),
785
+ $response->getBody()
786
+ );
787
+ }
788
+ );
789
+ }
790
+
791
+ /**
792
+ * Create request for operation 'getSmsCampaign'
793
+ *
794
+ * @param int $campaignId id of the SMS campaign (required)
795
+ *
796
+ * @throws \InvalidArgumentException
797
+ * @return \GuzzleHttp\Psr7\Request
798
+ */
799
+ protected function getSmsCampaignRequest($campaignId)
800
+ {
801
+ // verify the required parameter 'campaignId' is set
802
+ if ($campaignId === null) {
803
+ throw new \InvalidArgumentException(
804
+ 'Missing the required parameter $campaignId when calling getSmsCampaign'
805
+ );
806
+ }
807
+
808
+ $resourcePath = '/smsCampaigns/{campaignId}';
809
+ $formParams = [];
810
+ $queryParams = [];
811
+ $headerParams = [];
812
+ $httpBody = '';
813
+ $multipart = false;
814
+
815
+
816
+ // path params
817
+ if ($campaignId !== null) {
818
+ $resourcePath = str_replace(
819
+ '{' . 'campaignId' . '}',
820
+ ObjectSerializer::toPathValue($campaignId),
821
+ $resourcePath
822
+ );
823
+ }
824
+
825
+ // body params
826
+ $_tempBody = null;
827
+
828
+ if ($multipart) {
829
+ $headers = $this->headerSelector->selectHeadersForMultipart(
830
+ ['application/json']
831
+ );
832
+ } else {
833
+ $headers = $this->headerSelector->selectHeaders(
834
+ ['application/json'],
835
+ ['application/json']
836
+ );
837
+ }
838
+
839
+ // for model (json/xml)
840
+ if (isset($_tempBody)) {
841
+ // $_tempBody is the method argument, if present
842
+ $httpBody = $_tempBody;
843
+ // \stdClass has no __toString(), so we should encode it manually
844
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
845
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
846
+ }
847
+ } elseif (count($formParams) > 0) {
848
+ if ($multipart) {
849
+ $multipartContents = [];
850
+ foreach ($formParams as $formParamName => $formParamValue) {
851
+ $multipartContents[] = [
852
+ 'name' => $formParamName,
853
+ 'contents' => $formParamValue
854
+ ];
855
+ }
856
+ // for HTTP post (form)
857
+ $httpBody = new MultipartStream($multipartContents);
858
+
859
+ } elseif ($headers['Content-Type'] === 'application/json') {
860
+ $httpBody = \GuzzleHttp\json_encode($formParams);
861
+
862
+ } else {
863
+ // for HTTP post (form)
864
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
865
+ }
866
+ }
867
+
868
+ // this endpoint requires API key authentication
869
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
870
+ if ($apiKey !== null) {
871
+ $headers['api-key'] = $apiKey;
872
+ }
873
+ // this endpoint requires API key authentication
874
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
875
+ if ($apiKey !== null) {
876
+ $headers['partner-key'] = $apiKey;
877
+ }
878
+
879
+ $defaultHeaders = [];
880
+ if ($this->config->getUserAgent()) {
881
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
882
+ }
883
+
884
+ $headers = array_merge(
885
+ $defaultHeaders,
886
+ $headerParams,
887
+ $headers
888
+ );
889
+
890
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
891
+ return new Request(
892
+ 'GET',
893
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
894
+ $headers,
895
+ $httpBody
896
+ );
897
+ }
898
+
899
+ /**
900
+ * Operation getSmsCampaigns
901
+ *
902
+ * Returns the informations for all your created SMS campaigns
903
+ *
904
+ * @param string $status Status of campaign. (optional)
905
+ * @param \DateTime $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
906
+ * @param \DateTime $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
907
+ * @param int $limit Number limitation for the result returned (optional, default to 500)
908
+ * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0)
909
+ *
910
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
911
+ * @throws \InvalidArgumentException
912
+ * @return \SendinBlue\Client\Model\GetSmsCampaigns
913
+ */
914
+ public function getSmsCampaigns($status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0')
915
+ {
916
+ list($response) = $this->getSmsCampaignsWithHttpInfo($status, $startDate, $endDate, $limit, $offset);
917
+ return $response;
918
+ }
919
+
920
+ /**
921
+ * Operation getSmsCampaignsWithHttpInfo
922
+ *
923
+ * Returns the informations for all your created SMS campaigns
924
+ *
925
+ * @param string $status Status of campaign. (optional)
926
+ * @param \DateTime $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
927
+ * @param \DateTime $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
928
+ * @param int $limit Number limitation for the result returned (optional, default to 500)
929
+ * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0)
930
+ *
931
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
932
+ * @throws \InvalidArgumentException
933
+ * @return array of \SendinBlue\Client\Model\GetSmsCampaigns, HTTP status code, HTTP response headers (array of strings)
934
+ */
935
+ public function getSmsCampaignsWithHttpInfo($status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0')
936
+ {
937
+ $returnType = '\SendinBlue\Client\Model\GetSmsCampaigns';
938
+ $request = $this->getSmsCampaignsRequest($status, $startDate, $endDate, $limit, $offset);
939
+
940
+ try {
941
+ $options = $this->createHttpClientOption();
942
+ try {
943
+ $response = $this->client->send($request, $options);
944
+ } catch (RequestException $e) {
945
+ throw new ApiException(
946
+ "[{$e->getCode()}] {$e->getMessage()}",
947
+ $e->getCode(),
948
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
949
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
950
+ );
951
+ }
952
+
953
+ $statusCode = $response->getStatusCode();
954
+
955
+ if ($statusCode < 200 || $statusCode > 299) {
956
+ throw new ApiException(
957
+ sprintf(
958
+ '[%d] Error connecting to the API (%s)',
959
+ $statusCode,
960
+ $request->getUri()
961
+ ),
962
+ $statusCode,
963
+ $response->getHeaders(),
964
+ $response->getBody()
965
+ );
966
+ }
967
+
968
+ $responseBody = $response->getBody();
969
+ if ($returnType === '\SplFileObject') {
970
+ $content = $responseBody; //stream goes to serializer
971
+ } else {
972
+ $content = $responseBody->getContents();
973
+ if ($returnType !== 'string') {
974
+ $content = json_decode($content);
975
+ }
976
+ }
977
+
978
+ return [
979
+ ObjectSerializer::deserialize($content, $returnType, []),
980
+ $response->getStatusCode(),
981
+ $response->getHeaders()
982
+ ];
983
+
984
+ } catch (ApiException $e) {
985
+ switch ($e->getCode()) {
986
+ case 200:
987
+ $data = ObjectSerializer::deserialize(
988
+ $e->getResponseBody(),
989
+ '\SendinBlue\Client\Model\GetSmsCampaigns',
990
+ $e->getResponseHeaders()
991
+ );
992
+ $e->setResponseObject($data);
993
+ break;
994
+ case 400:
995
+ $data = ObjectSerializer::deserialize(
996
+ $e->getResponseBody(),
997
+ '\SendinBlue\Client\Model\ErrorModel',
998
+ $e->getResponseHeaders()
999
+ );
1000
+ $e->setResponseObject($data);
1001
+ break;
1002
+ }
1003
+ throw $e;
1004
+ }
1005
+ }
1006
+
1007
+ /**
1008
+ * Operation getSmsCampaignsAsync
1009
+ *
1010
+ * Returns the informations for all your created SMS campaigns
1011
+ *
1012
+ * @param string $status Status of campaign. (optional)
1013
+ * @param \DateTime $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1014
+ * @param \DateTime $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1015
+ * @param int $limit Number limitation for the result returned (optional, default to 500)
1016
+ * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0)
1017
+ *
1018
+ * @throws \InvalidArgumentException
1019
+ * @return \GuzzleHttp\Promise\PromiseInterface
1020
+ */
1021
+ public function getSmsCampaignsAsync($status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0')
1022
+ {
1023
+ return $this->getSmsCampaignsAsyncWithHttpInfo($status, $startDate, $endDate, $limit, $offset)
1024
+ ->then(
1025
+ function ($response) {
1026
+ return $response[0];
1027
+ }
1028
+ );
1029
+ }
1030
+
1031
+ /**
1032
+ * Operation getSmsCampaignsAsyncWithHttpInfo
1033
+ *
1034
+ * Returns the informations for all your created SMS campaigns
1035
+ *
1036
+ * @param string $status Status of campaign. (optional)
1037
+ * @param \DateTime $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1038
+ * @param \DateTime $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1039
+ * @param int $limit Number limitation for the result returned (optional, default to 500)
1040
+ * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0)
1041
+ *
1042
+ * @throws \InvalidArgumentException
1043
+ * @return \GuzzleHttp\Promise\PromiseInterface
1044
+ */
1045
+ public function getSmsCampaignsAsyncWithHttpInfo($status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0')
1046
+ {
1047
+ $returnType = '\SendinBlue\Client\Model\GetSmsCampaigns';
1048
+ $request = $this->getSmsCampaignsRequest($status, $startDate, $endDate, $limit, $offset);
1049
+
1050
+ return $this->client
1051
+ ->sendAsync($request, $this->createHttpClientOption())
1052
+ ->then(
1053
+ function ($response) use ($returnType) {
1054
+ $responseBody = $response->getBody();
1055
+ if ($returnType === '\SplFileObject') {
1056
+ $content = $responseBody; //stream goes to serializer
1057
+ } else {
1058
+ $content = $responseBody->getContents();
1059
+ if ($returnType !== 'string') {
1060
+ $content = json_decode($content);
1061
+ }
1062
+ }
1063
+
1064
+ return [
1065
+ ObjectSerializer::deserialize($content, $returnType, []),
1066
+ $response->getStatusCode(),
1067
+ $response->getHeaders()
1068
+ ];
1069
+ },
1070
+ function ($exception) {
1071
+ $response = $exception->getResponse();
1072
+ $statusCode = $response->getStatusCode();
1073
+ throw new ApiException(
1074
+ sprintf(
1075
+ '[%d] Error connecting to the API (%s)',
1076
+ $statusCode,
1077
+ $exception->getRequest()->getUri()
1078
+ ),
1079
+ $statusCode,
1080
+ $response->getHeaders(),
1081
+ $response->getBody()
1082
+ );
1083
+ }
1084
+ );
1085
+ }
1086
+
1087
+ /**
1088
+ * Create request for operation 'getSmsCampaigns'
1089
+ *
1090
+ * @param string $status Status of campaign. (optional)
1091
+ * @param \DateTime $startDate Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1092
+ * @param \DateTime $endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; ) (optional)
1093
+ * @param int $limit Number limitation for the result returned (optional, default to 500)
1094
+ * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0)
1095
+ *
1096
+ * @throws \InvalidArgumentException
1097
+ * @return \GuzzleHttp\Psr7\Request
1098
+ */
1099
+ protected function getSmsCampaignsRequest($status = null, $startDate = null, $endDate = null, $limit = '500', $offset = '0')
1100
+ {
1101
+ if ($limit !== null && $limit > 1000) {
1102
+ throw new \InvalidArgumentException('invalid value for "$limit" when calling SMSCampaignsApi.getSmsCampaigns, must be smaller than or equal to 1000.');
1103
+ }
1104
+
1105
+
1106
+ $resourcePath = '/smsCampaigns';
1107
+ $formParams = [];
1108
+ $queryParams = [];
1109
+ $headerParams = [];
1110
+ $httpBody = '';
1111
+ $multipart = false;
1112
+
1113
+ // query params
1114
+ if ($status !== null) {
1115
+ $queryParams['status'] = ObjectSerializer::toQueryValue($status);
1116
+ }
1117
+ // query params
1118
+ if ($startDate !== null) {
1119
+ $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate);
1120
+ }
1121
+ // query params
1122
+ if ($endDate !== null) {
1123
+ $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate);
1124
+ }
1125
+ // query params
1126
+ if ($limit !== null) {
1127
+ $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
1128
+ }
1129
+ // query params
1130
+ if ($offset !== null) {
1131
+ $queryParams['offset'] = ObjectSerializer::toQueryValue($offset);
1132
+ }
1133
+
1134
+
1135
+ // body params
1136
+ $_tempBody = null;
1137
+
1138
+ if ($multipart) {
1139
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1140
+ ['application/json']
1141
+ );
1142
+ } else {
1143
+ $headers = $this->headerSelector->selectHeaders(
1144
+ ['application/json'],
1145
+ ['application/json']
1146
+ );
1147
+ }
1148
+
1149
+ // for model (json/xml)
1150
+ if (isset($_tempBody)) {
1151
+ // $_tempBody is the method argument, if present
1152
+ $httpBody = $_tempBody;
1153
+ // \stdClass has no __toString(), so we should encode it manually
1154
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1155
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1156
+ }
1157
+ } elseif (count($formParams) > 0) {
1158
+ if ($multipart) {
1159
+ $multipartContents = [];
1160
+ foreach ($formParams as $formParamName => $formParamValue) {
1161
+ $multipartContents[] = [
1162
+ 'name' => $formParamName,
1163
+ 'contents' => $formParamValue
1164
+ ];
1165
+ }
1166
+ // for HTTP post (form)
1167
+ $httpBody = new MultipartStream($multipartContents);
1168
+
1169
+ } elseif ($headers['Content-Type'] === 'application/json') {
1170
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1171
+
1172
+ } else {
1173
+ // for HTTP post (form)
1174
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1175
+ }
1176
+ }
1177
+
1178
+ // this endpoint requires API key authentication
1179
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1180
+ if ($apiKey !== null) {
1181
+ $headers['api-key'] = $apiKey;
1182
+ }
1183
+ // this endpoint requires API key authentication
1184
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1185
+ if ($apiKey !== null) {
1186
+ $headers['partner-key'] = $apiKey;
1187
+ }
1188
+
1189
+ $defaultHeaders = [];
1190
+ if ($this->config->getUserAgent()) {
1191
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1192
+ }
1193
+
1194
+ $headers = array_merge(
1195
+ $defaultHeaders,
1196
+ $headerParams,
1197
+ $headers
1198
+ );
1199
+
1200
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1201
+ return new Request(
1202
+ 'GET',
1203
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1204
+ $headers,
1205
+ $httpBody
1206
+ );
1207
+ }
1208
+
1209
+ /**
1210
+ * Operation requestSmsRecipientExport
1211
+ *
1212
+ * Exports the recipients of the specified campaign.
1213
+ *
1214
+ * @param int $campaignId id of the campaign (required)
1215
+ * @param \SendinBlue\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional)
1216
+ *
1217
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1218
+ * @throws \InvalidArgumentException
1219
+ * @return \SendinBlue\Client\Model\CreatedProcessId
1220
+ */
1221
+ public function requestSmsRecipientExport($campaignId, $recipientExport = null)
1222
+ {
1223
+ list($response) = $this->requestSmsRecipientExportWithHttpInfo($campaignId, $recipientExport);
1224
+ return $response;
1225
+ }
1226
+
1227
+ /**
1228
+ * Operation requestSmsRecipientExportWithHttpInfo
1229
+ *
1230
+ * Exports the recipients of the specified campaign.
1231
+ *
1232
+ * @param int $campaignId id of the campaign (required)
1233
+ * @param \SendinBlue\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional)
1234
+ *
1235
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1236
+ * @throws \InvalidArgumentException
1237
+ * @return array of \SendinBlue\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings)
1238
+ */
1239
+ public function requestSmsRecipientExportWithHttpInfo($campaignId, $recipientExport = null)
1240
+ {
1241
+ $returnType = '\SendinBlue\Client\Model\CreatedProcessId';
1242
+ $request = $this->requestSmsRecipientExportRequest($campaignId, $recipientExport);
1243
+
1244
+ try {
1245
+ $options = $this->createHttpClientOption();
1246
+ try {
1247
+ $response = $this->client->send($request, $options);
1248
+ } catch (RequestException $e) {
1249
+ throw new ApiException(
1250
+ "[{$e->getCode()}] {$e->getMessage()}",
1251
+ $e->getCode(),
1252
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1253
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1254
+ );
1255
+ }
1256
+
1257
+ $statusCode = $response->getStatusCode();
1258
+
1259
+ if ($statusCode < 200 || $statusCode > 299) {
1260
+ throw new ApiException(
1261
+ sprintf(
1262
+ '[%d] Error connecting to the API (%s)',
1263
+ $statusCode,
1264
+ $request->getUri()
1265
+ ),
1266
+ $statusCode,
1267
+ $response->getHeaders(),
1268
+ $response->getBody()
1269
+ );
1270
+ }
1271
+
1272
+ $responseBody = $response->getBody();
1273
+ if ($returnType === '\SplFileObject') {
1274
+ $content = $responseBody; //stream goes to serializer
1275
+ } else {
1276
+ $content = $responseBody->getContents();
1277
+ if ($returnType !== 'string') {
1278
+ $content = json_decode($content);
1279
+ }
1280
+ }
1281
+
1282
+ return [
1283
+ ObjectSerializer::deserialize($content, $returnType, []),
1284
+ $response->getStatusCode(),
1285
+ $response->getHeaders()
1286
+ ];
1287
+
1288
+ } catch (ApiException $e) {
1289
+ switch ($e->getCode()) {
1290
+ case 202:
1291
+ $data = ObjectSerializer::deserialize(
1292
+ $e->getResponseBody(),
1293
+ '\SendinBlue\Client\Model\CreatedProcessId',
1294
+ $e->getResponseHeaders()
1295
+ );
1296
+ $e->setResponseObject($data);
1297
+ break;
1298
+ case 400:
1299
+ $data = ObjectSerializer::deserialize(
1300
+ $e->getResponseBody(),
1301
+ '\SendinBlue\Client\Model\ErrorModel',
1302
+ $e->getResponseHeaders()
1303
+ );
1304
+ $e->setResponseObject($data);
1305
+ break;
1306
+ case 404:
1307
+ $data = ObjectSerializer::deserialize(
1308
+ $e->getResponseBody(),
1309
+ '\SendinBlue\Client\Model\ErrorModel',
1310
+ $e->getResponseHeaders()
1311
+ );
1312
+ $e->setResponseObject($data);
1313
+ break;
1314
+ }
1315
+ throw $e;
1316
+ }
1317
+ }
1318
+
1319
+ /**
1320
+ * Operation requestSmsRecipientExportAsync
1321
+ *
1322
+ * Exports the recipients of the specified campaign.
1323
+ *
1324
+ * @param int $campaignId id of the campaign (required)
1325
+ * @param \SendinBlue\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional)
1326
+ *
1327
+ * @throws \InvalidArgumentException
1328
+ * @return \GuzzleHttp\Promise\PromiseInterface
1329
+ */
1330
+ public function requestSmsRecipientExportAsync($campaignId, $recipientExport = null)
1331
+ {
1332
+ return $this->requestSmsRecipientExportAsyncWithHttpInfo($campaignId, $recipientExport)
1333
+ ->then(
1334
+ function ($response) {
1335
+ return $response[0];
1336
+ }
1337
+ );
1338
+ }
1339
+
1340
+ /**
1341
+ * Operation requestSmsRecipientExportAsyncWithHttpInfo
1342
+ *
1343
+ * Exports the recipients of the specified campaign.
1344
+ *
1345
+ * @param int $campaignId id of the campaign (required)
1346
+ * @param \SendinBlue\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional)
1347
+ *
1348
+ * @throws \InvalidArgumentException
1349
+ * @return \GuzzleHttp\Promise\PromiseInterface
1350
+ */
1351
+ public function requestSmsRecipientExportAsyncWithHttpInfo($campaignId, $recipientExport = null)
1352
+ {
1353
+ $returnType = '\SendinBlue\Client\Model\CreatedProcessId';
1354
+ $request = $this->requestSmsRecipientExportRequest($campaignId, $recipientExport);
1355
+
1356
+ return $this->client
1357
+ ->sendAsync($request, $this->createHttpClientOption())
1358
+ ->then(
1359
+ function ($response) use ($returnType) {
1360
+ $responseBody = $response->getBody();
1361
+ if ($returnType === '\SplFileObject') {
1362
+ $content = $responseBody; //stream goes to serializer
1363
+ } else {
1364
+ $content = $responseBody->getContents();
1365
+ if ($returnType !== 'string') {
1366
+ $content = json_decode($content);
1367
+ }
1368
+ }
1369
+
1370
+ return [
1371
+ ObjectSerializer::deserialize($content, $returnType, []),
1372
+ $response->getStatusCode(),
1373
+ $response->getHeaders()
1374
+ ];
1375
+ },
1376
+ function ($exception) {
1377
+ $response = $exception->getResponse();
1378
+ $statusCode = $response->getStatusCode();
1379
+ throw new ApiException(
1380
+ sprintf(
1381
+ '[%d] Error connecting to the API (%s)',
1382
+ $statusCode,
1383
+ $exception->getRequest()->getUri()
1384
+ ),
1385
+ $statusCode,
1386
+ $response->getHeaders(),
1387
+ $response->getBody()
1388
+ );
1389
+ }
1390
+ );
1391
+ }
1392
+
1393
+ /**
1394
+ * Create request for operation 'requestSmsRecipientExport'
1395
+ *
1396
+ * @param int $campaignId id of the campaign (required)
1397
+ * @param \SendinBlue\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional)
1398
+ *
1399
+ * @throws \InvalidArgumentException
1400
+ * @return \GuzzleHttp\Psr7\Request
1401
+ */
1402
+ protected function requestSmsRecipientExportRequest($campaignId, $recipientExport = null)
1403
+ {
1404
+ // verify the required parameter 'campaignId' is set
1405
+ if ($campaignId === null) {
1406
+ throw new \InvalidArgumentException(
1407
+ 'Missing the required parameter $campaignId when calling requestSmsRecipientExport'
1408
+ );
1409
+ }
1410
+
1411
+ $resourcePath = '/smsCampaigns/{campaignId}/exportRecipients';
1412
+ $formParams = [];
1413
+ $queryParams = [];
1414
+ $headerParams = [];
1415
+ $httpBody = '';
1416
+ $multipart = false;
1417
+
1418
+
1419
+ // path params
1420
+ if ($campaignId !== null) {
1421
+ $resourcePath = str_replace(
1422
+ '{' . 'campaignId' . '}',
1423
+ ObjectSerializer::toPathValue($campaignId),
1424
+ $resourcePath
1425
+ );
1426
+ }
1427
+
1428
+ // body params
1429
+ $_tempBody = null;
1430
+ if (isset($recipientExport)) {
1431
+ $_tempBody = $recipientExport;
1432
+ }
1433
+
1434
+ if ($multipart) {
1435
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1436
+ ['application/json']
1437
+ );
1438
+ } else {
1439
+ $headers = $this->headerSelector->selectHeaders(
1440
+ ['application/json'],
1441
+ ['application/json']
1442
+ );
1443
+ }
1444
+
1445
+ // for model (json/xml)
1446
+ if (isset($_tempBody)) {
1447
+ // $_tempBody is the method argument, if present
1448
+ $httpBody = $_tempBody;
1449
+ // \stdClass has no __toString(), so we should encode it manually
1450
+ if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
1451
+ $httpBody = \GuzzleHttp\json_encode($httpBody);
1452
+ }
1453
+ } elseif (count($formParams) > 0) {
1454
+ if ($multipart) {
1455
+ $multipartContents = [];
1456
+ foreach ($formParams as $formParamName => $formParamValue) {
1457
+ $multipartContents[] = [
1458
+ 'name' => $formParamName,
1459
+ 'contents' => $formParamValue
1460
+ ];
1461
+ }
1462
+ // for HTTP post (form)
1463
+ $httpBody = new MultipartStream($multipartContents);
1464
+
1465
+ } elseif ($headers['Content-Type'] === 'application/json') {
1466
+ $httpBody = \GuzzleHttp\json_encode($formParams);
1467
+
1468
+ } else {
1469
+ // for HTTP post (form)
1470
+ $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1471
+ }
1472
+ }
1473
+
1474
+ // this endpoint requires API key authentication
1475
+ $apiKey = $this->config->getApiKeyWithPrefix('api-key');
1476
+ if ($apiKey !== null) {
1477
+ $headers['api-key'] = $apiKey;
1478
+ }
1479
+ // this endpoint requires API key authentication
1480
+ $apiKey = $this->config->getApiKeyWithPrefix('partner-key');
1481
+ if ($apiKey !== null) {
1482
+ $headers['partner-key'] = $apiKey;
1483
+ }
1484
+
1485
+ $defaultHeaders = [];
1486
+ if ($this->config->getUserAgent()) {
1487
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1488
+ }
1489
+
1490
+ $headers = array_merge(
1491
+ $defaultHeaders,
1492
+ $headerParams,
1493
+ $headers
1494
+ );
1495
+
1496
+ $query = \GuzzleHttp\Psr7\build_query($queryParams);
1497
+ return new Request(
1498
+ 'POST',
1499
+ $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
1500
+ $headers,
1501
+ $httpBody
1502
+ );
1503
+ }
1504
+
1505
+ /**
1506
+ * Operation sendSmsCampaignNow
1507
+ *
1508
+ * Send your SMS campaign immediately
1509
+ *
1510
+ * @param int $campaignId id of the campaign (required)
1511
+ *
1512
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1513
+ * @throws \InvalidArgumentException
1514
+ * @return void
1515
+ */
1516
+ public function sendSmsCampaignNow($campaignId)
1517
+ {
1518
+ $this->sendSmsCampaignNowWithHttpInfo($campaignId);
1519
+ }
1520
+
1521
+ /**
1522
+ * Operation sendSmsCampaignNowWithHttpInfo
1523
+ *
1524
+ * Send your SMS campaign immediately
1525
+ *
1526
+ * @param int $campaignId id of the campaign (required)
1527
+ *
1528
+ * @throws \SendinBlue\Client\ApiException on non-2xx response
1529
+ * @throws \InvalidArgumentException
1530
+ * @return array of null, HTTP status code, HTTP response headers (array of strings)
1531
+ */
1532
+ public function sendSmsCampaignNowWithHttpInfo($campaignId)
1533
+ {
1534
+ $returnType = '';
1535
+ $request = $this->sendSmsCampaignNowRequest($campaignId);
1536
+
1537
+ try {
1538
+ $options = $this->createHttpClientOption();
1539
+ try {
1540
+ $response = $this->client->send($request, $options);
1541
+ } catch (RequestException $e) {
1542
+ throw new ApiException(
1543
+ "[{$e->getCode()}] {$e->getMessage()}",
1544
+ $e->getCode(),
1545
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
1546
+ $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
1547
+ );
1548
+ }
1549
+
1550
+ $statusCode = $response->getStatusCode();
1551
+
1552
+ if ($statusCode < 200 || $statusCode > 299) {
1553
+ throw new ApiException(
1554
+ sprintf(
1555
+ '[%d] Error connecting to the API (%s)',
1556
+ $statusCode,
1557
+ $request->getUri()
1558
+ ),
1559
+ $statusCode,
1560
+ $response->getHeaders(),
1561
+ $response->getBody()
1562
+ );
1563
+ }
1564
+
1565
+ return [null, $statusCode, $response->getHeaders()];
1566
+
1567
+ } catch (ApiException $e) {
1568
+ switch ($e->getCode()) {
1569
+ case 400:
1570
+ $data = ObjectSerializer::deserialize(
1571
+ $e->getResponseBody(),
1572
+ '\SendinBlue\Client\Model\ErrorModel',
1573
+ $e->getResponseHeaders()
1574
+ );
1575
+ $e->setResponseObject($data);
1576
+ break;
1577
+ case 402:
1578
+ $data = ObjectSerializer::deserialize(
1579
+ $e->getResponseBody(),
1580
+ '\SendinBlue\Client\Model\ErrorModel',
1581
+ $e->getResponseHeaders()
1582
+ );
1583
+ $e->setResponseObject($data);
1584
+ break;
1585
+ case 404:
1586
+ $data = ObjectSerializer::deserialize(
1587
+ $e->getResponseBody(),
1588
+ '\SendinBlue\Client\Model\ErrorModel',
1589
+ $e->getResponseHeaders()
1590
+ );
1591
+ $e->setResponseObject($data);
1592
+ break;
1593
+ }
1594
+ throw $e;
1595
+ }
1596
+ }
1597
+
1598
+ /**
1599
+ * Operation sendSmsCampaignNowAsync
1600
+ *
1601
+ * Send your SMS campaign immediately
1602
+ *
1603
+ * @param int $campaignId id of the campaign (required)
1604
+ *
1605
+ * @throws \InvalidArgumentException
1606
+ * @return \GuzzleHttp\Promise\PromiseInterface
1607
+ */
1608
+ public function sendSmsCampaignNowAsync($campaignId)
1609
+ {
1610
+ return $this->sendSmsCampaignNowAsyncWithHttpInfo($campaignId)
1611
+ ->then(
1612
+ function ($response) {
1613
+ return $response[0];
1614
+ }
1615
+ );
1616
+ }
1617
+
1618
+ /**
1619
+ * Operation sendSmsCampaignNowAsyncWithHttpInfo
1620
+ *
1621
+ * Send your SMS campaign immediately
1622
+ *
1623
+ * @param int $campaignId id of the campaign (required)
1624
+ *
1625
+ * @throws \InvalidArgumentException
1626
+ * @return \GuzzleHttp\Promise\PromiseInterface
1627
+ */
1628
+ public function sendSmsCampaignNowAsyncWithHttpInfo($campaignId)
1629
+ {
1630
+ $returnType = '';
1631
+ $request = $this->sendSmsCampaignNowRequest($campaignId);
1632
+
1633
+ return $this->client
1634
+ ->sendAsync($request, $this->createHttpClientOption())
1635
+ ->then(
1636
+ function ($response) use ($returnType) {
1637
+ return [null, $response->getStatusCode(), $response->getHeaders()];
1638
+ },
1639
+ function ($exception) {
1640
+ $response = $exception->getResponse();
1641
+ $statusCode = $response->getStatusCode();
1642
+ throw new ApiException(
1643
+ sprintf(
1644
+ '[%d] Error connecting to the API (%s)',
1645
+ $statusCode,
1646
+ $exception->getRequest()->getUri()
1647
+ ),
1648
+ $statusCode,
1649
+ $response->getHeaders(),
1650
+ $response->getBody()
1651
+ );
1652
+ }
1653
+ );
1654
+ }
1655
+
1656
+ /**
1657
+ * Create request for operation 'sendSmsCampaignNow'
1658
+ *
1659
+ * @param int $campaignId id of the campaign (required)
1660
+ *
1661
+ * @throws \InvalidArgumentException
1662
+ * @return \GuzzleHttp\Psr7\Request
1663
+ */
1664
+ protected function sendSmsCampaignNowRequest($campaignId)
1665
+ {
1666
+ // verify the required parameter 'campaignId' is set
1667
+ if ($campaignId === null) {
1668
+ throw new \InvalidArgumentException(
1669
+ 'Missing the required parameter $campaignId when calling sendSmsCampaignNow'
1670
+ );
1671
+ }
1672
+
1673
+ $resourcePath = '/smsCampaigns/{campaignId}/sendNow';
1674
+ $formParams = [];
1675
+ $queryParams = [];
1676
+ $headerParams = [];
1677
+ $httpBody = '';
1678
+ $multipart = false;
1679
+
1680
+
1681
+ // path params
1682
+ if ($campaignId !== null) {
1683
+ $resourcePath = str_replace(
1684
+ '{' . 'campaignId' . '}',
1685
+ ObjectSerializer::toPathValue($campaignId),
1686
+ $resourcePath
1687
+ );
1688
+ }
1689
+
1690
+ // body params
1691
+ $_tempBody = null;
1692
+
1693
+ if ($multipart) {
1694
+ $headers = $this->headerSelector->selectHeadersForMultipart(
1695
+ ['application/json']
1696
+ );
1697
+ } else {
1698
+ $headers = $this->headerSelector->selectHeaders(
1699
+ ['application/json'],
1700
+ ['application/json']
1701
+ );
1702
+ }
1703
+