From f9b01ea9d2129d26ec24087c6ece94b4beecab67 Mon Sep 17 00:00:00 2001 From: Brice Le Boulch Date: Thu, 16 Nov 2017 17:08:51 +0100 Subject: [PATCH] Clean version of elasticemail lib --- README.md | 4 + composer.json | 26 + src/ElasticEmailClient/Account.php | 565 ++++++++++++++++++ src/ElasticEmailClient/ApiClient.php | 163 +++++ src/ElasticEmailClient/ApiException.php | 30 + .../ApiTypes/APIKeyAction.php | 25 + src/ElasticEmailClient/ApiTypes/Account.php | 239 ++++++++ .../ApiTypes/AccountOverview.php | 64 ++ .../ApiTypes/AdvancedOptions.php | 189 ++++++ .../ApiTypes/Attachment.php | 24 + .../ApiTypes/BlockedContact.php | 29 + .../ApiTypes/BouncedCategorySummary.php | 84 +++ src/ElasticEmailClient/ApiTypes/Campaign.php | 84 +++ .../ApiTypes/CampaignChannel.php | 179 ++++++ .../ApiTypes/CampaignStatus.php | 50 ++ .../ApiTypes/CampaignTemplate.php | 54 ++ .../ApiTypes/CampaignTriggerType.php | 35 ++ src/ElasticEmailClient/ApiTypes/Channel.php | 69 +++ .../ApiTypes/CompressionFormat.php | 20 + src/ElasticEmailClient/ApiTypes/Contact.php | 269 +++++++++ .../ApiTypes/ContactCollection.php | 19 + .../ApiTypes/ContactContainer.php | 19 + .../ApiTypes/ContactHistory.php | 49 ++ .../ApiTypes/ContactSource.php | 35 ++ .../ApiTypes/ContactStatus.php | 55 ++ .../ApiTypes/ContactStatusCounts.php | 54 ++ .../ApiTypes/CreditType.php | 20 + .../ApiTypes/DailyLogStatusSummary.php | 69 +++ .../ApiTypes/DomainDetail.php | 54 ++ src/ElasticEmailClient/ApiTypes/EEList.php | 44 ++ .../ApiTypes/EmailCredits.php | 29 + .../ApiTypes/EmailJobFailedStatus.php | 29 + .../ApiTypes/EmailJobStatus.php | 109 ++++ src/ElasticEmailClient/ApiTypes/EmailSend.php | 19 + .../ApiTypes/EmailStatus.php | 49 ++ src/ElasticEmailClient/ApiTypes/EmailView.php | 24 + .../ApiTypes/EncodingType.php | 45 ++ src/ElasticEmailClient/ApiTypes/Export.php | 44 ++ .../ApiTypes/ExportFileFormats.php | 25 + .../ApiTypes/ExportLink.php | 14 + .../ApiTypes/ExportStatus.php | 30 + .../ApiTypes/ExportTypeCounts.php | 34 ++ .../ApiTypes/IntervalType.php | 20 + .../ApiTypes/LinkTrackingDetails.php | 24 + .../ApiTypes/LitmusCredits.php | 19 + src/ElasticEmailClient/ApiTypes/Log.php | 24 + .../ApiTypes/LogJobStatus.php | 60 ++ .../ApiTypes/LogStatusSummary.php | 94 +++ .../ApiTypes/LogSummary.php | 24 + .../ApiTypes/MessageCategory.php | 95 +++ .../ApiTypes/NotificationQueue.php | 39 ++ .../ApiTypes/NotificationType.php | 25 + src/ElasticEmailClient/ApiTypes/Payment.php | 24 + src/ElasticEmailClient/ApiTypes/Profile.php | 69 +++ .../ApiTypes/QuestionType.php | 40 ++ src/ElasticEmailClient/ApiTypes/Recipient.php | 104 ++++ src/ElasticEmailClient/ApiTypes/Referral.php | 19 + .../ApiTypes/ReputationDetail.php | 79 +++ .../ApiTypes/ReputationHistory.php | 54 ++ .../ApiTypes/ReputationImpact.php | 49 ++ src/ElasticEmailClient/ApiTypes/Segment.php | 34 ++ .../ApiTypes/SegmentHistory.php | 59 ++ .../ApiTypes/SendingPermission.php | 50 ++ src/ElasticEmailClient/ApiTypes/SpamCheck.php | 44 ++ src/ElasticEmailClient/ApiTypes/SpamRule.php | 24 + .../ApiTypes/SplitOptimization.php | 20 + .../ApiTypes/SubAccount.php | 139 +++++ .../ApiTypes/SubAccountSettings.php | 84 +++ src/ElasticEmailClient/ApiTypes/Survey.php | 54 ++ .../ApiTypes/SurveyResultAnswerInfo.php | 24 + .../ApiTypes/SurveyResultInfo.php | 34 ++ .../ApiTypes/SurveyResultsAnswer.php | 24 + .../ApiTypes/SurveyResultsSummaryInfo.php | 19 + .../ApiTypes/SurveyStatus.php | 25 + .../ApiTypes/SurveyStep.php | 44 ++ .../ApiTypes/SurveyStepAnswer.php | 24 + .../ApiTypes/SurveyStepType.php | 35 ++ src/ElasticEmailClient/ApiTypes/Template.php | 69 +++ .../ApiTypes/TemplateList.php | 19 + .../ApiTypes/TemplateScope.php | 20 + .../ApiTypes/TemplateType.php | 20 + .../ApiTypes/TrackedLink.php | 24 + .../ApiTypes/TrackingType.php | 20 + src/ElasticEmailClient/ApiTypes/Usage.php | 24 + src/ElasticEmailClient/ApiTypes/UsageData.php | 104 ++++ src/ElasticEmailClient/Attachment.php | 74 +++ src/ElasticEmailClient/Campaign.php | 90 +++ src/ElasticEmailClient/Channel.php | 103 ++++ src/ElasticEmailClient/Contact.php | 440 ++++++++++++++ src/ElasticEmailClient/Domain.php | 99 +++ src/ElasticEmailClient/EEList.php | 231 +++++++ src/ElasticEmailClient/Email.php | 138 +++++ src/ElasticEmailClient/Export.php | 55 ++ src/ElasticEmailClient/Log.php | 193 ++++++ src/ElasticEmailClient/SMS.php | 22 + src/ElasticEmailClient/Segment.php | 118 ++++ src/ElasticEmailClient/Survey.php | 95 +++ src/ElasticEmailClient/Template.php | 176 ++++++ 98 files changed, 6804 insertions(+) create mode 100755 README.md create mode 100755 composer.json create mode 100755 src/ElasticEmailClient/Account.php create mode 100755 src/ElasticEmailClient/ApiClient.php create mode 100755 src/ElasticEmailClient/ApiException.php create mode 100755 src/ElasticEmailClient/ApiTypes/APIKeyAction.php create mode 100755 src/ElasticEmailClient/ApiTypes/Account.php create mode 100755 src/ElasticEmailClient/ApiTypes/AccountOverview.php create mode 100755 src/ElasticEmailClient/ApiTypes/AdvancedOptions.php create mode 100755 src/ElasticEmailClient/ApiTypes/Attachment.php create mode 100755 src/ElasticEmailClient/ApiTypes/BlockedContact.php create mode 100755 src/ElasticEmailClient/ApiTypes/BouncedCategorySummary.php create mode 100755 src/ElasticEmailClient/ApiTypes/Campaign.php create mode 100755 src/ElasticEmailClient/ApiTypes/CampaignChannel.php create mode 100755 src/ElasticEmailClient/ApiTypes/CampaignStatus.php create mode 100755 src/ElasticEmailClient/ApiTypes/CampaignTemplate.php create mode 100755 src/ElasticEmailClient/ApiTypes/CampaignTriggerType.php create mode 100755 src/ElasticEmailClient/ApiTypes/Channel.php create mode 100755 src/ElasticEmailClient/ApiTypes/CompressionFormat.php create mode 100755 src/ElasticEmailClient/ApiTypes/Contact.php create mode 100755 src/ElasticEmailClient/ApiTypes/ContactCollection.php create mode 100755 src/ElasticEmailClient/ApiTypes/ContactContainer.php create mode 100755 src/ElasticEmailClient/ApiTypes/ContactHistory.php create mode 100755 src/ElasticEmailClient/ApiTypes/ContactSource.php create mode 100755 src/ElasticEmailClient/ApiTypes/ContactStatus.php create mode 100755 src/ElasticEmailClient/ApiTypes/ContactStatusCounts.php create mode 100755 src/ElasticEmailClient/ApiTypes/CreditType.php create mode 100755 src/ElasticEmailClient/ApiTypes/DailyLogStatusSummary.php create mode 100755 src/ElasticEmailClient/ApiTypes/DomainDetail.php create mode 100755 src/ElasticEmailClient/ApiTypes/EEList.php create mode 100755 src/ElasticEmailClient/ApiTypes/EmailCredits.php create mode 100755 src/ElasticEmailClient/ApiTypes/EmailJobFailedStatus.php create mode 100755 src/ElasticEmailClient/ApiTypes/EmailJobStatus.php create mode 100755 src/ElasticEmailClient/ApiTypes/EmailSend.php create mode 100755 src/ElasticEmailClient/ApiTypes/EmailStatus.php create mode 100755 src/ElasticEmailClient/ApiTypes/EmailView.php create mode 100755 src/ElasticEmailClient/ApiTypes/EncodingType.php create mode 100755 src/ElasticEmailClient/ApiTypes/Export.php create mode 100755 src/ElasticEmailClient/ApiTypes/ExportFileFormats.php create mode 100755 src/ElasticEmailClient/ApiTypes/ExportLink.php create mode 100755 src/ElasticEmailClient/ApiTypes/ExportStatus.php create mode 100755 src/ElasticEmailClient/ApiTypes/ExportTypeCounts.php create mode 100755 src/ElasticEmailClient/ApiTypes/IntervalType.php create mode 100755 src/ElasticEmailClient/ApiTypes/LinkTrackingDetails.php create mode 100755 src/ElasticEmailClient/ApiTypes/LitmusCredits.php create mode 100755 src/ElasticEmailClient/ApiTypes/Log.php create mode 100755 src/ElasticEmailClient/ApiTypes/LogJobStatus.php create mode 100755 src/ElasticEmailClient/ApiTypes/LogStatusSummary.php create mode 100755 src/ElasticEmailClient/ApiTypes/LogSummary.php create mode 100755 src/ElasticEmailClient/ApiTypes/MessageCategory.php create mode 100755 src/ElasticEmailClient/ApiTypes/NotificationQueue.php create mode 100755 src/ElasticEmailClient/ApiTypes/NotificationType.php create mode 100755 src/ElasticEmailClient/ApiTypes/Payment.php create mode 100755 src/ElasticEmailClient/ApiTypes/Profile.php create mode 100755 src/ElasticEmailClient/ApiTypes/QuestionType.php create mode 100755 src/ElasticEmailClient/ApiTypes/Recipient.php create mode 100755 src/ElasticEmailClient/ApiTypes/Referral.php create mode 100755 src/ElasticEmailClient/ApiTypes/ReputationDetail.php create mode 100755 src/ElasticEmailClient/ApiTypes/ReputationHistory.php create mode 100755 src/ElasticEmailClient/ApiTypes/ReputationImpact.php create mode 100755 src/ElasticEmailClient/ApiTypes/Segment.php create mode 100755 src/ElasticEmailClient/ApiTypes/SegmentHistory.php create mode 100755 src/ElasticEmailClient/ApiTypes/SendingPermission.php create mode 100755 src/ElasticEmailClient/ApiTypes/SpamCheck.php create mode 100755 src/ElasticEmailClient/ApiTypes/SpamRule.php create mode 100755 src/ElasticEmailClient/ApiTypes/SplitOptimization.php create mode 100755 src/ElasticEmailClient/ApiTypes/SubAccount.php create mode 100755 src/ElasticEmailClient/ApiTypes/SubAccountSettings.php create mode 100755 src/ElasticEmailClient/ApiTypes/Survey.php create mode 100755 src/ElasticEmailClient/ApiTypes/SurveyResultAnswerInfo.php create mode 100755 src/ElasticEmailClient/ApiTypes/SurveyResultInfo.php create mode 100755 src/ElasticEmailClient/ApiTypes/SurveyResultsAnswer.php create mode 100755 src/ElasticEmailClient/ApiTypes/SurveyResultsSummaryInfo.php create mode 100755 src/ElasticEmailClient/ApiTypes/SurveyStatus.php create mode 100755 src/ElasticEmailClient/ApiTypes/SurveyStep.php create mode 100755 src/ElasticEmailClient/ApiTypes/SurveyStepAnswer.php create mode 100755 src/ElasticEmailClient/ApiTypes/SurveyStepType.php create mode 100755 src/ElasticEmailClient/ApiTypes/Template.php create mode 100755 src/ElasticEmailClient/ApiTypes/TemplateList.php create mode 100755 src/ElasticEmailClient/ApiTypes/TemplateScope.php create mode 100755 src/ElasticEmailClient/ApiTypes/TemplateType.php create mode 100755 src/ElasticEmailClient/ApiTypes/TrackedLink.php create mode 100755 src/ElasticEmailClient/ApiTypes/TrackingType.php create mode 100755 src/ElasticEmailClient/ApiTypes/Usage.php create mode 100755 src/ElasticEmailClient/ApiTypes/UsageData.php create mode 100755 src/ElasticEmailClient/Attachment.php create mode 100755 src/ElasticEmailClient/Campaign.php create mode 100755 src/ElasticEmailClient/Channel.php create mode 100755 src/ElasticEmailClient/Contact.php create mode 100755 src/ElasticEmailClient/Domain.php create mode 100755 src/ElasticEmailClient/EEList.php create mode 100755 src/ElasticEmailClient/Email.php create mode 100755 src/ElasticEmailClient/Export.php create mode 100755 src/ElasticEmailClient/Log.php create mode 100755 src/ElasticEmailClient/SMS.php create mode 100755 src/ElasticEmailClient/Segment.php create mode 100755 src/ElasticEmailClient/Survey.php create mode 100755 src/ElasticEmailClient/Template.php diff --git a/README.md b/README.md new file mode 100755 index 0000000..11ddc52 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Description +Clean version of [ElasticEmail/ElasticEmail.WebApiClient-php](https://github.com/ElasticEmail/ElasticEmail.WebApiClient-php) + +(Implementation of PSR-4) \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100755 index 0000000..f51131a --- /dev/null +++ b/composer.json @@ -0,0 +1,26 @@ +{ + "name": "airmanbzh/elasticemail", + "type": "library", + "description": "Clean adaptation of elastic-email/web-api-client", + "keywords": ["elastic","email", "elasticemail", "transactional", "web", "api"], + "homepage": "https://github.com/Airmanbzh/elasticemail", + "license": "MIT", + "authors": [ + { + "name": "LE BOULC'H Brice", + "email": "airmanbzh@gmail.com", + "role": "Developer" + } + ], + "support": { + "issues": "https://github.com/airmanbzh/elasticemail/issues" + }, + "autoload": { + "psr-4": { + "ElasticEmailClient\\": "src/ElasticEmailClient/" + } + }, + "require": { + "php": ">=5.3.0" + } +} \ No newline at end of file diff --git a/src/ElasticEmailClient/Account.php b/src/ElasticEmailClient/Account.php new file mode 100755 index 0000000..f3bf3f0 --- /dev/null +++ b/src/ElasticEmailClient/Account.php @@ -0,0 +1,565 @@ + $email, + 'password' => $password, + 'confirmPassword' => $confirmPassword, + 'requiresEmailCredits' => $requiresEmailCredits, + 'enableLitmusTest' => $enableLitmusTest, + 'requiresLitmusCredits' => $requiresLitmusCredits, + 'maxContacts' => $maxContacts, + 'enablePrivateIPRequest' => $enablePrivateIPRequest, + 'sendActivation' => $sendActivation, + 'returnUrl' => $returnUrl, + 'sendingPermission' => $sendingPermission, + 'enableContactFeatures' => $enableContactFeatures, + 'poolName' => $poolName, + 'emailSizeLimit' => $emailSizeLimit, + 'dailySendLimit' => $dailySendLimit + )); + } + + /** + * Add email, template or litmus credits to a sub-account + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $credits Amount of credits to add + * @param string $notes Specific notes about the transaction + * @param ApiTypes\CreditType $creditType Type of credits to add (Email or Litmus) + * @param string $subAccountEmail Email address of sub-account + * @param string $publicAccountID Public key of sub-account to add credits to. Use subAccountEmail or publicAccountID not both. + */ + public function AddSubAccountCredits($credits, $notes, $creditType = ApiTypes\CreditType::Email, $subAccountEmail = null, $publicAccountID = null) { + return ApiClient::Request('account/addsubaccountcredits', array( + 'credits' => $credits, + 'notes' => $notes, + 'creditType' => $creditType, + 'subAccountEmail' => $subAccountEmail, + 'publicAccountID' => $publicAccountID + )); + } + + /** + * Change your email address. Remember, that your email address is used as login! + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $newEmail New email address. + * @param string $confirmEmail New email address. + * @param string $sourceUrl URL from which request was sent. + * @return string + */ + public function ChangeEmail($newEmail, $confirmEmail, $sourceUrl = "https://elasticemail.com/account/") { + return ApiClient::Request('account/changeemail', array( + 'newEmail' => $newEmail, + 'confirmEmail' => $confirmEmail, + 'sourceUrl' => $sourceUrl + )); + } + + /** + * Create new password for your account. Password needs to be at least 6 characters long. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $currentPassword Current password. + * @param string $newPassword New password for account. + * @param string $confirmPassword Repeat new password. + */ + public function ChangePassword($currentPassword, $newPassword, $confirmPassword) { + return ApiClient::Request('account/changepassword', array( + 'currentPassword' => $currentPassword, + 'newPassword' => $newPassword, + 'confirmPassword' => $confirmPassword + )); + } + + /** + * Deletes specified Subaccount + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param bool $notify True, if you want to send an email notification. Otherwise, false + * @param string $subAccountEmail Email address of sub-account + * @param string $publicAccountID Public key of sub-account to delete. Use subAccountEmail or publicAccountID not both. + */ + public function DeleteSubAccount($notify = true, $subAccountEmail = null, $publicAccountID = null) { + return ApiClient::Request('account/deletesubaccount', array( + 'notify' => $notify, + 'subAccountEmail' => $subAccountEmail, + 'publicAccountID' => $publicAccountID + )); + } + + /** + * Returns API Key for the given Sub Account. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $subAccountEmail Email address of sub-account + * @param string $publicAccountID Public key of sub-account to retrieve sub-account API Key. Use subAccountEmail or publicAccountID not both. + * @return string + */ + public function GetSubAccountApiKey($subAccountEmail = null, $publicAccountID = null) { + return ApiClient::Request('account/getsubaccountapikey', array( + 'subAccountEmail' => $subAccountEmail, + 'publicAccountID' => $publicAccountID + )); + } + + /** + * Lists all of your subaccounts + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return Array + */ + public function GetSubAccountList() { + return ApiClient::Request('account/getsubaccountlist'); + } + + /** + * Loads your account. Returns detailed information about your account. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return ApiTypes\Account + */ + public function Load() { + return ApiClient::Request('account/load'); + } + + /** + * Load advanced options of your account + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return ApiTypes\AdvancedOptions + */ + public function LoadAdvancedOptions() { + return ApiClient::Request('account/loadadvancedoptions'); + } + + /** + * Lists email credits history + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return Array + */ + public function LoadEmailCreditsHistory() { + return ApiClient::Request('account/loademailcreditshistory'); + } + + /** + * Lists litmus credits history + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return Array + */ + public function LoadLitmusCreditsHistory() { + return ApiClient::Request('account/loadlitmuscreditshistory'); + } + + /** + * Shows queue of newest notifications - very useful when you want to check what happened with mails that were not received. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return Array + */ + public function LoadNotificationQueue() { + return ApiClient::Request('account/loadnotificationqueue'); + } + + /** + * Lists all payments + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @param DateTime $fromDate Starting date for search in YYYY-MM-DDThh:mm:ss format. + * @param DateTime $toDate Ending date for search in YYYY-MM-DDThh:mm:ss format. + * @return Array + */ + public function LoadPaymentHistory($limit, $offset, $fromDate, $toDate) { + return ApiClient::Request('account/loadpaymenthistory', array( + 'limit' => $limit, + 'offset' => $offset, + 'fromDate' => $fromDate, + 'toDate' => $toDate + )); + } + + /** + * Lists all referral payout history + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return Array + */ + public function LoadPayoutHistory() { + return ApiClient::Request('account/loadpayouthistory'); + } + + /** + * Shows information about your referral details + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return ApiTypes\Referral + */ + public function LoadReferralDetails() { + return ApiClient::Request('account/loadreferraldetails'); + } + + /** + * Shows latest changes in your sending reputation + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @return Array + */ + public function LoadReputationHistory($limit = 20, $offset = 0) { + return ApiClient::Request('account/loadreputationhistory', array( + 'limit' => $limit, + 'offset' => $offset + )); + } + + /** + * Shows detailed information about your actual reputation score + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return ApiTypes\ReputationDetail + */ + public function LoadReputationImpact() { + return ApiClient::Request('account/loadreputationimpact'); + } + + /** + * Returns detailed spam check. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @return Array + */ + public function LoadSpamCheck($limit = 20, $offset = 0) { + return ApiClient::Request('account/loadspamcheck', array( + 'limit' => $limit, + 'offset' => $offset + )); + } + + /** + * Lists email credits history for sub-account + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $subAccountEmail Email address of sub-account + * @param string $publicAccountID Public key of sub-account to list history for. Use subAccountEmail or publicAccountID not both. + * @return Array + */ + public function LoadSubAccountsEmailCreditsHistory($subAccountEmail = null, $publicAccountID = null) { + return ApiClient::Request('account/loadsubaccountsemailcreditshistory', array( + 'subAccountEmail' => $subAccountEmail, + 'publicAccountID' => $publicAccountID + )); + } + + /** + * Loads settings of subaccount + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $subAccountEmail Email address of sub-account + * @param string $publicAccountID Public key of sub-account to load settings for. Use subAccountEmail or publicAccountID not both. + * @return ApiTypes\SubAccountSettings + */ + public function LoadSubAccountSettings($subAccountEmail = null, $publicAccountID = null) { + return ApiClient::Request('account/loadsubaccountsettings', array( + 'subAccountEmail' => $subAccountEmail, + 'publicAccountID' => $publicAccountID + )); + } + + /** + * Lists litmus credits history for sub-account + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $subAccountEmail Email address of sub-account + * @param string $publicAccountID Public key of sub-account to list history for. Use subAccountEmail or publicAccountID not both. + * @return Array + */ + public function LoadSubAccountsLitmusCreditsHistory($subAccountEmail = null, $publicAccountID = null) { + return ApiClient::Request('account/loadsubaccountslitmuscreditshistory', array( + 'subAccountEmail' => $subAccountEmail, + 'publicAccountID' => $publicAccountID + )); + } + + /** + * Shows usage of your account in given time. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. + * @param DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. + * @return Array + */ + public function LoadUsage($from, $to) { + return ApiClient::Request('account/loadusage', array( + 'from' => $from, + 'to' => $to + )); + } + + /** + * Manages your apikeys. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $apiKey APIKey you would like to manage. + * @param ApiTypes\APIKeyAction $action Specific action you would like to perform on the APIKey + * @return Array + */ + public function ManageApiKeys($apiKey, $action) { + return ApiClient::Request('account/manageapikeys', array( + 'apiKey' => $apiKey, + 'action' => $action + )); + } + + /** + * Shows summary for your account. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return ApiTypes\AccountOverview + */ + public function Overview() { + return ApiClient::Request('account/overview'); + } + + /** + * Shows you account's profile basic overview + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return ApiTypes\Profile + */ + public function ProfileOverview() { + return ApiClient::Request('account/profileoverview'); + } + + /** + * Remove email, template or litmus credits from a sub-account + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param ApiTypes\CreditType $creditType Type of credits to add (Email or Litmus) + * @param string $notes Specific notes about the transaction + * @param string $subAccountEmail Email address of sub-account + * @param string $publicAccountID Public key of sub-account to remove credits from. Use subAccountEmail or publicAccountID not both. + * @param ?int $credits Amount of credits to remove + * @param bool $removeAll Remove all credits of this type from sub-account (overrides credits if provided) + */ + public function RemoveSubAccountCredits($creditType, $notes, $subAccountEmail = null, $publicAccountID = null, $credits = null, $removeAll = false) { + return ApiClient::Request('account/removesubaccountcredits', array( + 'creditType' => $creditType, + 'notes' => $notes, + 'subAccountEmail' => $subAccountEmail, + 'publicAccountID' => $publicAccountID, + 'credits' => $credits, + 'removeAll' => $removeAll + )); + } + + /** + * Request a private IP for your Account + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $count Number of items. + * @param string $notes Free form field of notes + */ + public function RequestPrivateIP($count, $notes) { + return ApiClient::Request('account/requestprivateip', array( + 'count' => $count, + 'notes' => $notes + )); + } + + /** + * Update sending and tracking options of your account. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param ?bool $enableClickTracking True, if you want to track clicks. Otherwise, false + * @param ?bool $enableLinkClickTracking True, if you want to track by link tracking. Otherwise, false + * @param ?bool $manageSubscriptions True, if you want to display your labels on your unsubscribe form. Otherwise, false + * @param ?bool $manageSubscribedOnly True, if you want to only display labels that the contact is subscribed to on your unsubscribe form. Otherwise, false + * @param ?bool $transactionalOnUnsubscribe True, if you want to display an option for the contact to opt into transactional email only on your unsubscribe form. Otherwise, false + * @param ?bool $skipListUnsubscribe True, if you do not want to use list-unsubscribe headers. Otherwise, false + * @param ?bool $autoTextFromHtml True, if text BODY of message should be created automatically. Otherwise, false + * @param ?bool $allowCustomHeaders True, if you want to apply custom headers to your emails. Otherwise, false + * @param string $bccEmail Email address to send a copy of all email to. + * @param string $contentTransferEncoding Type of content encoding + * @param ?bool $emailNotificationForError True, if you want bounce notifications returned. Otherwise, false + * @param string $emailNotificationEmail Specific email address to send bounce email notifications to. + * @param string $webNotificationUrl URL address to receive web notifications to parse and process. + * @param ?bool $webNotificationNotifyOncePerEmail True, if you want to receive notifications for each type only once per email. Otherwise, false + * @param ?bool $webNotificationForSent True, if you want to send web notifications for sent email. Otherwise, false + * @param ?bool $webNotificationForOpened True, if you want to send web notifications for opened email. Otherwise, false + * @param ?bool $webNotificationForClicked True, if you want to send web notifications for clicked email. Otherwise, false + * @param ?bool $webNotificationForUnsubscribed True, if you want to send web notifications for unsubscribed email. Otherwise, false + * @param ?bool $webNotificationForAbuseReport True, if you want to send web notifications for complaint email. Otherwise, false + * @param ?bool $webNotificationForError True, if you want to send web notifications for bounced email. Otherwise, false + * @param string $hubCallBackUrl URL used for tracking action of inbound emails + * @param string $inboundDomain Domain you use as your inbound domain + * @param ?bool $inboundContactsOnly True, if you want inbound email to only process contacts from your account. Otherwise, false + * @param ?bool $lowCreditNotification True, if you want to receive low credit email notifications. Otherwise, false + * @param ?bool $enableUITooltips True, if account has tooltips active. Otherwise, false + * @param ?bool $enableContactFeatures True, if you want to use Advanced Tools. Otherwise, false + * @param string $notificationsEmails Email addresses to send a copy of all notifications from our system. Separated by semicolon + * @param string $unsubscribeNotificationsEmails Emails, separated by semicolon, to which the notification about contact unsubscribing should be sent to + * @param string $logoUrl URL to your logo image. + * @param ?bool $enableTemplateScripting True, if you want to use template scripting in your emails {{}}. Otherwise, false + * @param ?int $staleContactScore (0 means this functionality is NOT enabled) Score, depending on the number of times you have sent to a recipient, at which the given recipient should be moved to the Stale status + * @param ?int $staleContactInactiveDays (0 means this functionality is NOT enabled) Number of days of inactivity for a contact after which the given recipient should be moved to the Stale status + * @param string $deliveryReason Why your clients are receiving your emails. + * @param ?bool $tutorialsEnabled + * @return ApiTypes\AdvancedOptions + */ + public function UpdateAdvancedOptions($enableClickTracking = null, $enableLinkClickTracking = null, $manageSubscriptions = null, $manageSubscribedOnly = null, $transactionalOnUnsubscribe = null, $skipListUnsubscribe = null, $autoTextFromHtml = null, $allowCustomHeaders = null, $bccEmail = null, $contentTransferEncoding = null, $emailNotificationForError = null, $emailNotificationEmail = null, $webNotificationUrl = null, $webNotificationNotifyOncePerEmail = null, $webNotificationForSent = null, $webNotificationForOpened = null, $webNotificationForClicked = null, $webNotificationForUnsubscribed = null, $webNotificationForAbuseReport = null, $webNotificationForError = null, $hubCallBackUrl = "", $inboundDomain = null, $inboundContactsOnly = null, $lowCreditNotification = null, $enableUITooltips = null, $enableContactFeatures = null, $notificationsEmails = null, $unsubscribeNotificationsEmails = null, $logoUrl = null, $enableTemplateScripting = true, $staleContactScore = null, $staleContactInactiveDays = null, $deliveryReason = null, $tutorialsEnabled = null) { + return ApiClient::Request('account/updateadvancedoptions', array( + 'enableClickTracking' => $enableClickTracking, + 'enableLinkClickTracking' => $enableLinkClickTracking, + 'manageSubscriptions' => $manageSubscriptions, + 'manageSubscribedOnly' => $manageSubscribedOnly, + 'transactionalOnUnsubscribe' => $transactionalOnUnsubscribe, + 'skipListUnsubscribe' => $skipListUnsubscribe, + 'autoTextFromHtml' => $autoTextFromHtml, + 'allowCustomHeaders' => $allowCustomHeaders, + 'bccEmail' => $bccEmail, + 'contentTransferEncoding' => $contentTransferEncoding, + 'emailNotificationForError' => $emailNotificationForError, + 'emailNotificationEmail' => $emailNotificationEmail, + 'webNotificationUrl' => $webNotificationUrl, + 'webNotificationNotifyOncePerEmail' => $webNotificationNotifyOncePerEmail, + 'webNotificationForSent' => $webNotificationForSent, + 'webNotificationForOpened' => $webNotificationForOpened, + 'webNotificationForClicked' => $webNotificationForClicked, + 'webNotificationForUnsubscribed' => $webNotificationForUnsubscribed, + 'webNotificationForAbuseReport' => $webNotificationForAbuseReport, + 'webNotificationForError' => $webNotificationForError, + 'hubCallBackUrl' => $hubCallBackUrl, + 'inboundDomain' => $inboundDomain, + 'inboundContactsOnly' => $inboundContactsOnly, + 'lowCreditNotification' => $lowCreditNotification, + 'enableUITooltips' => $enableUITooltips, + 'enableContactFeatures' => $enableContactFeatures, + 'notificationsEmails' => $notificationsEmails, + 'unsubscribeNotificationsEmails' => $unsubscribeNotificationsEmails, + 'logoUrl' => $logoUrl, + 'enableTemplateScripting' => $enableTemplateScripting, + 'staleContactScore' => $staleContactScore, + 'staleContactInactiveDays' => $staleContactInactiveDays, + 'deliveryReason' => $deliveryReason, + 'tutorialsEnabled' => $tutorialsEnabled + )); + } + + /** + * Update settings of your private branding. These settings are needed, if you want to use Elastic Email under your brand. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param bool $enablePrivateBranding True: Turn on or off ability to send mails under your brand. Otherwise, false + * @param string $logoUrl URL to your logo image. + * @param string $supportLink Address to your support. + * @param string $privateBrandingUrl Subdomain for your rebranded service + * @param string $smtpAddress Address of SMTP server. + * @param string $smtpAlternative Address of alternative SMTP server. + * @param string $paymentUrl URL for making payments. + */ + public function UpdateCustomBranding($enablePrivateBranding = false, $logoUrl = null, $supportLink = null, $privateBrandingUrl = null, $smtpAddress = null, $smtpAlternative = null, $paymentUrl = null) { + return ApiClient::Request('account/updatecustombranding', array( + 'enablePrivateBranding' => $enablePrivateBranding, + 'logoUrl' => $logoUrl, + 'supportLink' => $supportLink, + 'privateBrandingUrl' => $privateBrandingUrl, + 'smtpAddress' => $smtpAddress, + 'smtpAlternative' => $smtpAlternative, + 'paymentUrl' => $paymentUrl + )); + } + + /** + * Update http notification URL. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $url URL of notification. + * @param bool $notifyOncePerEmail True, if you want to receive notifications for each type only once per email. Otherwise, false + * @param string $settings Http notification settings serialized to JSON + */ + public function UpdateHttpNotification($url, $notifyOncePerEmail = false, $settings = null) { + return ApiClient::Request('account/updatehttpnotification', array( + 'url' => $url, + 'notifyOncePerEmail' => $notifyOncePerEmail, + 'settings' => $settings + )); + } + + /** + * Update your profile. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $firstName First name. + * @param string $lastName Last name. + * @param string $address1 First line of address. + * @param string $city City. + * @param string $state State or province. + * @param string $zip Zip/postal code. + * @param int $countryID Numeric ID of country. A file with the list of countries is available here + * @param ?bool $marketingConsent True if you want to receive newsletters from Elastic Email. Otherwise, false. Empty to leave the current value. + * @param string $address2 Second line of address. + * @param string $company Company name. + * @param string $website HTTP address of your website. + * @param string $logoUrl URL to your logo image. + * @param string $taxCode Code used for tax purposes. + * @param string $phone Phone number + */ + public function UpdateProfile($firstName, $lastName, $address1, $city, $state, $zip, $countryID, $marketingConsent = null, $address2 = null, $company = null, $website = null, $logoUrl = null, $taxCode = null, $phone = null) { + return ApiClient::Request('account/updateprofile', array( + 'firstName' => $firstName, + 'lastName' => $lastName, + 'address1' => $address1, + 'city' => $city, + 'state' => $state, + 'zip' => $zip, + 'countryID' => $countryID, + 'marketingConsent' => $marketingConsent, + 'address2' => $address2, + 'company' => $company, + 'website' => $website, + 'logoUrl' => $logoUrl, + 'taxCode' => $taxCode, + 'phone' => $phone + )); + } + + /** + * Updates settings of specified subaccount + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param bool $requiresEmailCredits True, if account needs credits to send emails. Otherwise, false + * @param int $monthlyRefillCredits Amount of credits added to account automatically + * @param bool $requiresLitmusCredits True, if account needs credits to send emails. Otherwise, false + * @param bool $enableLitmusTest True, if account is able to send template tests to Litmus. Otherwise, false + * @param ?int $dailySendLimit Amount of emails account can send daily + * @param int $emailSizeLimit Maximum size of email including attachments in MB's + * @param bool $enablePrivateIPRequest True, if account can request for private IP on its own. Otherwise, false + * @param int $maxContacts Maximum number of contacts the account can have + * @param string $subAccountEmail Email address of sub-account + * @param string $publicAccountID Public key of sub-account to update. Use subAccountEmail or publicAccountID not both. + * @param ?ApiTypes\SendingPermission $sendingPermission Sending permission setting for account + * @param ?bool $enableContactFeatures True, if you want to use Advanced Tools. Otherwise, false + * @param string $poolName Name of your custom IP Pool to be used in the sending process + */ + public function UpdateSubAccountSettings($requiresEmailCredits = false, $monthlyRefillCredits = 0, $requiresLitmusCredits = false, $enableLitmusTest = false, $dailySendLimit = null, $emailSizeLimit = 10, $enablePrivateIPRequest = false, $maxContacts = 0, $subAccountEmail = null, $publicAccountID = null, $sendingPermission = null, $enableContactFeatures = null, $poolName = null) { + return ApiClient::Request('account/updatesubaccountsettings', array( + 'requiresEmailCredits' => $requiresEmailCredits, + 'monthlyRefillCredits' => $monthlyRefillCredits, + 'requiresLitmusCredits' => $requiresLitmusCredits, + 'enableLitmusTest' => $enableLitmusTest, + 'dailySendLimit' => $dailySendLimit, + 'emailSizeLimit' => $emailSizeLimit, + 'enablePrivateIPRequest' => $enablePrivateIPRequest, + 'maxContacts' => $maxContacts, + 'subAccountEmail' => $subAccountEmail, + 'publicAccountID' => $publicAccountID, + 'sendingPermission' => $sendingPermission, + 'enableContactFeatures' => $enableContactFeatures, + 'poolName' => $poolName + )); + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiClient.php b/src/ElasticEmailClient/ApiClient.php new file mode 100755 index 0000000..94c9b6d --- /dev/null +++ b/src/ElasticEmailClient/ApiClient.php @@ -0,0 +1,163 @@ + $url, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HEADER => false, + CURLOPT_SSL_VERIFYPEER => false + )); + + if ($method === "POST" && count($attachments) > 0) { + foreach ($attachments as $k => $attachment) { + $att = self::attachFile($attachment); + $postnameSplit = explode('/', $att->postname); + $att->postname = trim(end($postnameSplit)); + $data['file_'. $k] = $att; + } + } + + if ($method === "POST") + { + curl_setopt($ch, CURLOPT_POST, true); + if (empty($attachments)) { + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); + } else { + error_reporting(E_ALL ^ E_NOTICE); + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + } + } + + $response = self::executeWithRetry($ch, true); + + if ($response === false) + { + throw new ApiException($url, $method, 'Request Error: ' . curl_error($ch)); + } + curl_close($ch); + $jsonResult = json_decode($response); + $parseError = self::getParseError(); + if ($parseError !== false) + { + throw new ApiException($url, $method, 'Request Error: ' . $parseError, $response); + } + if ($jsonResult->success === false) + { + throw new ApiException($url, $method, $jsonResult->error); + } + + return (isset($jsonResult->data)? $jsonResult->data : null); + } + + public static function executeWithRetry($ch, $sleep = false) + { + $counter = 0; + $maxRetries = 3; + $lastErr = null; + $sleepInSeconds = 5; + + while ($counter < $maxRetries) + { + try + { + $response = curl_exec($ch); + return $response; + } + catch (\Exception $e) + { + $counter++; + $lastErr = $e->getMessage(); + + if ($sleep) + { + sleep($sleepInSeconds); + } + } + } + + throw new \Exception('Error after '.$maxRetries.' retries: '.$lastErr); + } + + public static function getFile($target, $data) + { + self::cleanNullData($data); + $data['apikey'] = self::$apiKey; + $url = self::$ApiUri . $target; + $ch = curl_init(); + curl_setopt_array($ch, array( + CURLOPT_URL => $url, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HEADER => false, + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => $data + )); + $response = curl_exec($ch); + if ($response === false) + { + throw new ApiException($url, "POST", 'Request Error: ' . curl_error($ch)); + } + curl_close($ch); + return $response; + } + + public static function SetApiKey($apiKey) + { + self::$apiKey = $apiKey; + } + + private static function cleanNullData(&$data) + { + foreach ($data as $key => $item) + { + if ($item === null) + { + unset($data[$key]); + } + if (is_bool($item)) + { + $data[$key] = ($item) ? 'true' : 'false'; + } + } + } + + private static function attachFile($attachment) + { + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $mimeType = finfo_file($finfo, $attachment); + finfo_close($finfo); + $save_file = realpath($attachment); + return new \CurlFile($save_file, $mimeType, $attachment); + } + + private static function getParseError() + { + switch (json_last_error()) { + case JSON_ERROR_NONE: + return false; + case JSON_ERROR_DEPTH: + return 'Maximum stack depth exceeded'; + case JSON_ERROR_STATE_MISMATCH: + return 'Underflow or the modes mismatch'; + case JSON_ERROR_CTRL_CHAR: + return 'Unexpected control character found'; + case JSON_ERROR_SYNTAX: + return 'Syntax error, malformed JSON'; + case JSON_ERROR_UTF8: + return 'Malformed UTF-8 characters, possibly incorrectly encoded'; + default: + return 'Unknown error'; + } + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiException.php b/src/ElasticEmailClient/ApiException.php new file mode 100755 index 0000000..b05a45e --- /dev/null +++ b/src/ElasticEmailClient/ApiException.php @@ -0,0 +1,30 @@ +url = $url; + $this->method = $method; + $this->rawResponse = $rawResponse; + parent::__construct($message); + } + + public function __toString() + { + return strtoupper($this->method) . ' ' . $this->url . ' returned: ' . $this->getMessage(); + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/APIKeyAction.php b/src/ElasticEmailClient/ApiTypes/APIKeyAction.php new file mode 100755 index 0000000..611c4cf --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/APIKeyAction.php @@ -0,0 +1,25 @@ +here + */ + public /*?int*/ $CountryID; + + /** + * Phone number + */ + public /*string*/ $Phone; + + /** + * Proper email address. + */ + public /*string*/ $Email; + + /** + * URL for affiliating. + */ + public /*string*/ $AffiliateLink; + + /** + * Numeric reputation + */ + public /*double*/ $Reputation; + + /** + * Amount of emails sent from this account + */ + public /*long*/ $TotalEmailsSent; + + /** + * Amount of emails sent from this account + */ + public /*?long*/ $MonthlyEmailsSent; + + /** + * Amount of emails sent from this account + */ + public /*decimal*/ $Credit; + + /** + * Amount of email credits + */ + public /*int*/ $EmailCredits; + + /** + * Amount of emails sent from this account + */ + public /*decimal*/ $PricePerEmail; + + /** + * Why your clients are receiving your emails. + */ + public /*string*/ $DeliveryReason; + + /** + * URL for making payments. + */ + public /*string*/ $AccountPaymentUrl; + + /** + * Address of SMTP server. + */ + public /*string*/ $Smtp; + + /** + * Address of alternative SMTP server. + */ + public /*string*/ $SmtpAlternative; + + /** + * Status of automatic payments configuration. + */ + public /*string*/ $AutoCreditStatus; + + /** + * When AutoCreditStatus is Enabled, the credit level that triggers the credit to be recharged. + */ + public /*decimal*/ $AutoCreditLevel; + + /** + * When AutoCreditStatus is Enabled, the amount of credit to be recharged. + */ + public /*decimal*/ $AutoCreditAmount; + + /** + * Amount of emails account can send daily + */ + public /*int*/ $DailySendLimit; + + /** + * Creation date. + */ + public /*DateTime*/ $DateCreated; + + /** + * True, if you have enabled link tracking. Otherwise, false + */ + public /*bool*/ $LinkTracking; + + /** + * Type of content encoding + */ + public /*string*/ $ContentTransferEncoding; + + /** + * Amount of Litmus credits + */ + public /*decimal*/ $LitmusCredits; + + /** + * Enable advanced tools on your Account. + */ + public /*bool*/ $EnableContactFeatures; + + /** + * + */ + public /*bool*/ $NeedsSMSVerification; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/AccountOverview.php b/src/ElasticEmailClient/ApiTypes/AccountOverview.php new file mode 100755 index 0000000..7028fc0 --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/AccountOverview.php @@ -0,0 +1,64 @@ +*/ $Targets; + + /** + * Number of event, triggering mail sending + */ + public /*ApiTypes\CampaignTriggerType*/ $TriggerType; + + /** + * Date of triggered send + */ + public /*?DateTime*/ $TriggerDate; + + /** + * How far into the future should the campaign be sent, in minutes + */ + public /*double*/ $TriggerDelay; + + /** + * When your next automatic mail will be sent, in minutes + */ + public /*double*/ $TriggerFrequency; + + /** + * How many times should the campaign be sent + */ + public /*int*/ $TriggerCount; + + /** + * ID number of transaction + */ + public /*int*/ $TriggerChannelID; + + /** + * Data for filtering event campaigns such as specific link addresses. + */ + public /*string*/ $TriggerData; + + /** + * What should be checked for choosing the winner: opens or clicks + */ + public /*ApiTypes\SplitOptimization*/ $SplitOptimization; + + /** + * Number of minutes between sends during optimization period + */ + public /*int*/ $SplitOptimizationMinutes; + + /** + * + */ + public /*int*/ $TimingOption; + + /** + * + */ + public /*Array*/ $CampaignTemplates; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/CampaignChannel.php b/src/ElasticEmailClient/ApiTypes/CampaignChannel.php new file mode 100755 index 0000000..b91a3ec --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/CampaignChannel.php @@ -0,0 +1,179 @@ +*/ $Targets; + + /** + * Number of event, triggering mail sending + */ + public /*ApiTypes\CampaignTriggerType*/ $TriggerType; + + /** + * Date of triggered send + */ + public /*?DateTime*/ $TriggerDate; + + /** + * How far into the future should the campaign be sent, in minutes + */ + public /*double*/ $TriggerDelay; + + /** + * When your next automatic mail will be sent, in minutes + */ + public /*double*/ $TriggerFrequency; + + /** + * How many times should the campaign be sent + */ + public /*int*/ $TriggerCount; + + /** + * ID number of transaction + */ + public /*int*/ $TriggerChannelID; + + /** + * Data for filtering event campaigns such as specific link addresses. + */ + public /*string*/ $TriggerData; + + /** + * What should be checked for choosing the winner: opens or clicks + */ + public /*ApiTypes\SplitOptimization*/ $SplitOptimization; + + /** + * Number of minutes between sends during optimization period + */ + public /*int*/ $SplitOptimizationMinutes; + + /** + * + */ + public /*int*/ $TimingOption; + + /** + * ID number of template. + */ + public /*?int*/ $TemplateID; + + /** + * Default subject of email. + */ + public /*string*/ $TemplateSubject; + + /** + * Default From: email address. + */ + public /*string*/ $TemplateFromEmail; + + /** + * Default From: name. + */ + public /*string*/ $TemplateFromName; + + /** + * Default Reply: email address. + */ + public /*string*/ $TemplateReplyEmail; + + /** + * Default Reply: name. + */ + public /*string*/ $TemplateReplyName; + + /** + * Total emails clicked + */ + public /*int*/ $ClickedCount; + + /** + * Total emails opened. + */ + public /*int*/ $OpenedCount; + + /** + * Overall number of recipients + */ + public /*int*/ $RecipientCount; + + /** + * Total emails sent. + */ + public /*int*/ $SentCount; + + /** + * Total emails sent. + */ + public /*int*/ $FailedCount; + + /** + * Total emails clicked + */ + public /*int*/ $UnsubscribedCount; + + /** + * Abuses - mails sent to user without their consent + */ + public /*int*/ $FailedAbuse; + + /** + * List of CampaignTemplate for sending A-X split testing. + */ + public /*Array*/ $TemplateChannels; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/CampaignStatus.php b/src/ElasticEmailClient/ApiTypes/CampaignStatus.php new file mode 100755 index 0000000..1ee5949 --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/CampaignStatus.php @@ -0,0 +1,50 @@ +*/ $Lists; + + /** + * Segments which contain the requested contact + */ + public /*Array*/ $Segments; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/ContactContainer.php b/src/ElasticEmailClient/ApiTypes/ContactContainer.php new file mode 100755 index 0000000..8a46f12 --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/ContactContainer.php @@ -0,0 +1,19 @@ +*/ $Failed; + + /** + * Total emails sent. + */ + public /*int*/ $FailedCount; + + /** + * + */ + public /*Array*/ $Sent; + + /** + * Total emails sent. + */ + public /*int*/ $SentCount; + + /** + * Number of delivered messages + */ + public /*Array*/ $Delivered; + + /** + * + */ + public /*int*/ $DeliveredCount; + + /** + * + */ + public /*Array*/ $Pending; + + /** + * + */ + public /*int*/ $PendingCount; + + /** + * Number of opened messages + */ + public /*Array*/ $Opened; + + /** + * Total emails opened. + */ + public /*int*/ $OpenedCount; + + /** + * Number of clicked messages + */ + public /*Array*/ $Clicked; + + /** + * Total emails clicked + */ + public /*int*/ $ClickedCount; + + /** + * Number of unsubscribed messages + */ + public /*Array*/ $Unsubscribed; + + /** + * Total emails clicked + */ + public /*int*/ $UnsubscribedCount; + + /** + * + */ + public /*Array*/ $AbuseReports; + + /** + * + */ + public /*int*/ $AbuseReportsCount; + + /** + * List of all MessageIDs for this job. + */ + public /*Array*/ $MessageIDs; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/EmailSend.php b/src/ElasticEmailClient/ApiTypes/EmailSend.php new file mode 100755 index 0000000..a25f76d --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/EmailSend.php @@ -0,0 +1,19 @@ +*/ $TrackedLink; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/LitmusCredits.php b/src/ElasticEmailClient/ApiTypes/LitmusCredits.php new file mode 100755 index 0000000..dd16dd8 --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/LitmusCredits.php @@ -0,0 +1,19 @@ +*/ $Recipients; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/LogJobStatus.php b/src/ElasticEmailClient/ApiTypes/LogJobStatus.php new file mode 100755 index 0000000..624e8aa --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/LogJobStatus.php @@ -0,0 +1,60 @@ +*/ $DailyLogStatusSummary; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/MessageCategory.php b/src/ElasticEmailClient/ApiTypes/MessageCategory.php new file mode 100755 index 0000000..b86c85c --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/MessageCategory.php @@ -0,0 +1,95 @@ +here + */ + public /*?int*/ $CountryID; + + /** + * Phone number + */ + public /*string*/ $Phone; + + /** + * Proper email address. + */ + public /*string*/ $Email; + + /** + * Code used for tax purposes. + */ + public /*string*/ $TaxCode; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/QuestionType.php b/src/ElasticEmailClient/ApiTypes/QuestionType.php new file mode 100755 index 0000000..f4a665e --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/QuestionType.php @@ -0,0 +1,40 @@ +*/ $History; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/SegmentHistory.php b/src/ElasticEmailClient/ApiTypes/SegmentHistory.php new file mode 100755 index 0000000..3789302 --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/SegmentHistory.php @@ -0,0 +1,59 @@ +*/ $Rules; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/SpamRule.php b/src/ElasticEmailClient/ApiTypes/SpamRule.php new file mode 100755 index 0000000..a068f13 --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/SpamRule.php @@ -0,0 +1,24 @@ +*/ $SurveySteps; + + /** + * URL of the survey + */ + public /*string*/ $SurveyLink; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/SurveyResultAnswerInfo.php b/src/ElasticEmailClient/ApiTypes/SurveyResultAnswerInfo.php new file mode 100755 index 0000000..6652657 --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/SurveyResultAnswerInfo.php @@ -0,0 +1,24 @@ +*/ $SurveyResultAnswers; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/SurveyResultsAnswer.php b/src/ElasticEmailClient/ApiTypes/SurveyResultsAnswer.php new file mode 100755 index 0000000..7d99402 --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/SurveyResultsAnswer.php @@ -0,0 +1,24 @@ +*/ $Summary; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/SurveyStatus.php b/src/ElasticEmailClient/ApiTypes/SurveyStatus.php new file mode 100755 index 0000000..9746c0e --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/SurveyStatus.php @@ -0,0 +1,25 @@ +*/ $SurveyStepAnswers; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/SurveyStepAnswer.php b/src/ElasticEmailClient/ApiTypes/SurveyStepAnswer.php new file mode 100755 index 0000000..16a6ba3 --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/SurveyStepAnswer.php @@ -0,0 +1,24 @@ +*/ $Templates; + + /** + * List of draft templates + */ + public /*Array*/ $DraftTemplate; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/TemplateScope.php b/src/ElasticEmailClient/ApiTypes/TemplateScope.php new file mode 100755 index 0000000..ec8f2aa --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/TemplateScope.php @@ -0,0 +1,20 @@ +*/ $List; + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/ApiTypes/UsageData.php b/src/ElasticEmailClient/ApiTypes/UsageData.php new file mode 100755 index 0000000..7ab6273 --- /dev/null +++ b/src/ElasticEmailClient/ApiTypes/UsageData.php @@ -0,0 +1,104 @@ + $attachmentID + )); + } + + /** + * Gets address of chosen Attachment + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param long $attachmentID ID number of your attachment. + * @return File + */ + public function Get($attachmentID) { + return ApiClient::getFile('attachment/get', array( + 'attachmentID' => $attachmentID + )); + } + + /** + * Lists your available Attachments in the given email + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $msgID ID number of selected message. + * @return Array + */ + public function EEList($msgID) { + return ApiClient::Request('attachment/list', array( + 'msgID' => $msgID + )); + } + + /** + * Lists all your available attachments + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return Array + */ + public function ListAll() { + return ApiClient::Request('attachment/listall'); + } + + /** + * Permanently removes attachment file from your account + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $fileName Name of your file. + */ + public function Remove($fileName) { + return ApiClient::Request('attachment/remove', array( + 'fileName' => $fileName + )); + } + + /** + * Uploads selected file to the server using http form upload format (MIME multipart/form-data) or PUT method. The attachments expire after 30 days. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param File $attachmentFile Content of your attachment. + * @return ApiTypes\Attachment + */ + public function Upload($attachmentFile) { + return ApiClient::Request('attachment/upload', array(), "POST", $attachmentFile); + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/Campaign.php b/src/ElasticEmailClient/Campaign.php new file mode 100755 index 0000000..0700bdf --- /dev/null +++ b/src/ElasticEmailClient/Campaign.php @@ -0,0 +1,90 @@ + $campaign + )); + } + + /** + * Copy selected campaign + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $channelID ID number of selected Channel. + * @return int + */ + public function EECopy($channelID) { + return ApiClient::Request('campaign/copy', array( + 'channelID' => $channelID + )); + } + + /** + * Delete selected campaign + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $channelID ID number of selected Channel. + */ + public function EEDelete($channelID) { + return ApiClient::Request('campaign/delete', array( + 'channelID' => $channelID + )); + } + + /** + * Export selected campaigns to chosen file format. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param array $channelIDs List of campaign IDs used for processing + * @param ApiTypes\ExportFileFormats $fileFormat Format of the exported file + * @param ApiTypes\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. + * @param string $fileName Name of your file. + * @return ApiTypes\ExportLink + */ + public function Export(array $channelIDs = array(), $fileFormat = ApiTypes\ExportFileFormats::Csv, $compressionFormat = ApiTypes\CompressionFormat::None, $fileName = null) { + return ApiClient::Request('campaign/export', array( + 'channelIDs' => (count($channelIDs) === 0) ? null : join(';', $channelIDs), + 'fileFormat' => $fileFormat, + 'compressionFormat' => $compressionFormat, + 'fileName' => $fileName + )); + } + + /** + * List all of your campaigns + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $search Text fragment used for searching. + * @param int $offset How many items should be loaded ahead. + * @param int $limit Maximum of loaded items. + * @return Array + */ + public function EEList($search = null, $offset = 0, $limit = 0) { + return ApiClient::Request('campaign/list', array( + 'search' => $search, + 'offset' => $offset, + 'limit' => $limit + )); + } + + /** + * Updates a previously added campaign. Only Active and Paused campaigns can be updated. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param ApiTypes\Campaign $campaign Json representation of a campaign + * @return int + */ + public function Update($campaign) { + return ApiClient::Request('campaign/update', array( + 'campaign' => $campaign + )); + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/Channel.php b/src/ElasticEmailClient/Channel.php new file mode 100755 index 0000000..c31551c --- /dev/null +++ b/src/ElasticEmailClient/Channel.php @@ -0,0 +1,103 @@ + $name + )); + } + + /** + * Delete the channel. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $name The name of the channel to delete. + */ + public function EEDelete($name) { + return ApiClient::Request('channel/delete', array( + 'name' => $name + )); + } + + /** + * Export channels in CSV file format. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param array $channelNames List of channel names used for processing + * @param ApiTypes\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. + * @param string $fileName Name of your file. + * @return File + */ + public function ExportCsv($channelNames, $compressionFormat = ApiTypes\CompressionFormat::None, $fileName = null) { + return ApiClient::getFile('channel/exportcsv', array( + 'channelNames' => (count($channelNames) === 0) ? null : join(';', $channelNames), + 'compressionFormat' => $compressionFormat, + 'fileName' => $fileName + )); + } + + /** + * Export channels in JSON file format. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param array $channelNames List of channel names used for processing + * @param ApiTypes\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. + * @param string $fileName Name of your file. + * @return File + */ + public function ExportJson($channelNames, $compressionFormat = ApiTypes\CompressionFormat::None, $fileName = null) { + return ApiClient::getFile('channel/exportjson', array( + 'channelNames' => (count($channelNames) === 0) ? null : join(';', $channelNames), + 'compressionFormat' => $compressionFormat, + 'fileName' => $fileName + )); + } + + /** + * Export channels in XML file format. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param array $channelNames List of channel names used for processing + * @param ApiTypes\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. + * @param string $fileName Name of your file. + * @return File + */ + public function ExportXml($channelNames, $compressionFormat = ApiTypes\CompressionFormat::None, $fileName = null) { + return ApiClient::getFile('channel/exportxml', array( + 'channelNames' => (count($channelNames) === 0) ? null : join(';', $channelNames), + 'compressionFormat' => $compressionFormat, + 'fileName' => $fileName + )); + } + + /** + * List all of your channels + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return Array + */ + public function EEList() { + return ApiClient::Request('channel/list'); + } + + /** + * Rename an existing channel. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $name The name of the channel to update. + * @param string $newName The new name for the channel. + * @return string + */ + public function Update($name, $newName) { + return ApiClient::Request('channel/update', array( + 'name' => $name, + 'newName' => $newName + )); + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/Contact.php b/src/ElasticEmailClient/Contact.php new file mode 100755 index 0000000..4dfef85 --- /dev/null +++ b/src/ElasticEmailClient/Contact.php @@ -0,0 +1,440 @@ + $publicListID ID code of list + * @param array $listName Name of your list. + * @param string $title Title + * @param string $firstName First name. + * @param string $lastName Last name. + * @param string $phone Phone number + * @param string $mobileNumber Mobile phone number + * @param string $notes Free form field of notes + * @param string $gender Your gender + * @param ?DateTime $birthDate Date of birth in YYYY-MM-DD format + * @param string $city City. + * @param string $state State or province. + * @param string $postalCode Zip/postal code. + * @param string $country Name of country. + * @param string $organizationName Name of organization + * @param string $website HTTP address of your website. + * @param ?int $annualRevenue Annual revenue of contact + * @param string $industry Industry contact works in + * @param ?int $numberOfEmployees Number of employees + * @param ApiTypes\ContactSource $source Specifies the way of uploading the contact + * @param string $returnUrl URL to navigate to after account creation + * @param string $sourceUrl URL from which request was sent. + * @param string $activationReturnUrl The url to return the contact to after activation. + * @param string $activationTemplate + * @param bool $sendActivation True, if you want to send activation email to this account. Otherwise, false + * @param ?DateTime $consentDate Date of consent to send this contact(s) your email. If not provided current date is used for consent. + * @param string $consentIP IP address of consent to send this contact(s) your email. If not provided your current public IP address is used for consent. + * @param array $field Custom contact field like firstname, lastname, city etc. Request parameters prefixed by field_ like field_firstname, field_lastname + * @param string $notifyEmail Emails, separated by semicolon, to which the notification about contact subscribing should be sent to + * @return string + */ + public function Add($publicAccountID, $email, array $publicListID = array(), array $listName = array(), $title = null, $firstName = null, $lastName = null, $phone = null, $mobileNumber = null, $notes = null, $gender = null, $birthDate = null, $city = null, $state = null, $postalCode = null, $country = null, $organizationName = null, $website = null, $annualRevenue = null, $industry = null, $numberOfEmployees = null, $source = ApiTypes\ContactSource::ContactApi, $returnUrl = null, $sourceUrl = null, $activationReturnUrl = null, $activationTemplate = null, $sendActivation = true, $consentDate = null, $consentIP = null, array $field = array(), $notifyEmail = null) { + $arr = array('publicAccountID' => $publicAccountID, + 'email' => $email, + 'publicListID' => (count($publicListID) === 0) ? null : join(';', $publicListID), + 'listName' => (count($listName) === 0) ? null : join(';', $listName), + 'title' => $title, + 'firstName' => $firstName, + 'lastName' => $lastName, + 'phone' => $phone, + 'mobileNumber' => $mobileNumber, + 'notes' => $notes, + 'gender' => $gender, + 'birthDate' => $birthDate, + 'city' => $city, + 'state' => $state, + 'postalCode' => $postalCode, + 'country' => $country, + 'organizationName' => $organizationName, + 'website' => $website, + 'annualRevenue' => $annualRevenue, + 'industry' => $industry, + 'numberOfEmployees' => $numberOfEmployees, + 'source' => $source, + 'returnUrl' => $returnUrl, + 'sourceUrl' => $sourceUrl, + 'activationReturnUrl' => $activationReturnUrl, + 'activationTemplate' => $activationTemplate, + 'sendActivation' => $sendActivation, + 'consentDate' => $consentDate, + 'consentIP' => $consentIP, + 'notifyEmail' => $notifyEmail ); + foreach(array_keys($field) as $key) { + $arr['field_'.$key] = $field[$key]; + } + return ApiClient::Request('contact/add', $arr); + } + + /** + * Manually add or update a contacts status to Abuse, Bounced or Unsubscribed status (blocked). + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $email Proper email address. + * @param ApiTypes\ContactStatus $status Name of status: Active, Engaged, Inactive, Abuse, Bounced, Unsubscribed. + */ + public function AddBlocked($email, $status) { + return ApiClient::Request('contact/addblocked', array( + 'email' => $email, + 'status' => $status + )); + } + + /** + * Change any property on the contact record. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $email Proper email address. + * @param string $name Name of the contact property you want to change. + * @param string $value Value you would like to change the contact property to. + */ + public function ChangeProperty($email, $name, $value) { + return ApiClient::Request('contact/changeproperty', array( + 'email' => $email, + 'name' => $name, + 'value' => $value + )); + } + + /** + * Changes status of selected Contacts. You may provide RULE for selection or specify list of Contact IDs. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param ApiTypes\ContactStatus $status Name of status: Active, Engaged, Inactive, Abuse, Bounced, Unsubscribed. + * @param string $rule Query used for filtering. + * @param array $emails Comma delimited list of contact emails + * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false + */ + public function ChangeStatus($status, $rule = null, array $emails = array(), $allContacts = false) { + return ApiClient::Request('contact/changestatus', array( + 'status' => $status, + 'rule' => $rule, + 'emails' => (count($emails) === 0) ? null : join(';', $emails), + 'allContacts' => $allContacts + )); + } + + /** + * Returns number of Contacts, RULE specifies contact Status. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $rule Query used for filtering. + * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false + * @return ApiTypes\ContactStatusCounts + */ + public function CountByStatus($rule = null, $allContacts = false) { + return ApiClient::Request('contact/countbystatus', array( + 'rule' => $rule, + 'allContacts' => $allContacts + )); + } + + /** + * Permanantly deletes the contacts provided. You can provide either a qualified rule or a list of emails (comma separated string). + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $rule Query used for filtering. + * @param array $emails Comma delimited list of contact emails + * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false + */ + public function EEDelete($rule = null, array $emails = array(), $allContacts = false) { + return ApiClient::Request('contact/delete', array( + 'rule' => $rule, + 'emails' => (count($emails) === 0) ? null : join(';', $emails), + 'allContacts' => $allContacts + )); + } + + /** + * Export selected Contacts to JSON. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param ApiTypes\ExportFileFormats $fileFormat Format of the exported file + * @param string $rule Query used for filtering. + * @param array $emails Comma delimited list of contact emails + * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false + * @param ApiTypes\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. + * @param string $fileName Name of your file. + * @return ApiTypes\ExportLink + */ + public function Export($fileFormat = ApiTypes\ExportFileFormats::Csv, $rule = null, array $emails = array(), $allContacts = false, $compressionFormat = ApiTypes\CompressionFormat::None, $fileName = null) { + return ApiClient::Request('contact/export', array( + 'fileFormat' => $fileFormat, + 'rule' => $rule, + 'emails' => (count($emails) === 0) ? null : join(';', $emails), + 'allContacts' => $allContacts, + 'compressionFormat' => $compressionFormat, + 'fileName' => $fileName + )); + } + + /** + * Finds all Lists and Segments this email belongs to. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $email Proper email address. + * @return ApiTypes\ContactCollection + */ + public function FindContact($email) { + return ApiClient::Request('contact/findcontact', array( + 'email' => $email + )); + } + + /** + * List of Contacts for provided List + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $listName Name of your list. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @return Array + */ + public function GetContactsByList($listName, $limit = 20, $offset = 0) { + return ApiClient::Request('contact/getcontactsbylist', array( + 'listName' => $listName, + 'limit' => $limit, + 'offset' => $offset + )); + } + + /** + * List of Contacts for provided Segment + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $segmentName Name of your segment. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @return Array + */ + public function GetContactsBySegment($segmentName, $limit = 20, $offset = 0) { + return ApiClient::Request('contact/getcontactsbysegment', array( + 'segmentName' => $segmentName, + 'limit' => $limit, + 'offset' => $offset + )); + } + + /** + * List of all contacts. If you have not specified RULE, all Contacts will be listed. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $rule Query used for filtering. + * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @return Array + */ + public function EEList($rule = null, $allContacts = false, $limit = 20, $offset = 0) { + return ApiClient::Request('contact/list', array( + 'rule' => $rule, + 'allContacts' => $allContacts, + 'limit' => $limit, + 'offset' => $offset + )); + } + + /** + * Load blocked contacts + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param array $statuses List of blocked statuses: Abuse, Bounced or Unsubscribed + * @param string $search Text fragment used for searching. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @return Array + */ + public function LoadBlocked($statuses, $search = null, $limit = 0, $offset = 0) { + return ApiClient::Request('contact/loadblocked', array( + 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses), + 'search' => $search, + 'limit' => $limit, + 'offset' => $offset + )); + } + + /** + * Load detailed contact information + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $email Proper email address. + * @return ApiTypes\Contact + */ + public function LoadContact($email) { + return ApiClient::Request('contact/loadcontact', array( + 'email' => $email + )); + } + + /** + * Shows detailed history of chosen Contact. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $email Proper email address. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @return Array + */ + public function LoadHistory($email, $limit = 0, $offset = 0) { + return ApiClient::Request('contact/loadhistory', array( + 'email' => $email, + 'limit' => $limit, + 'offset' => $offset + )); + } + + /** + * Add new Contact to one of your Lists. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param array $emails Comma delimited list of contact emails + * @param string $firstName First name. + * @param string $lastName Last name. + * @param string $title Title + * @param string $organization Name of organization + * @param string $industry Industry contact works in + * @param string $city City. + * @param string $country Name of country. + * @param string $state State or province. + * @param string $zip Zip/postal code. + * @param string $publicListID ID code of list + * @param string $listName Name of your list. + * @param ApiTypes\ContactStatus $status Name of status: Active, Engaged, Inactive, Abuse, Bounced, Unsubscribed. + * @param string $notes Free form field of notes + * @param ?DateTime $consentDate Date of consent to send this contact(s) your email. If not provided current date is used for consent. + * @param string $consentIP IP address of consent to send this contact(s) your email. If not provided your current public IP address is used for consent. + * @param string $notifyEmail Emails, separated by semicolon, to which the notification about contact subscribing should be sent to + */ + public function QuickAdd($emails, $firstName = null, $lastName = null, $title = null, $organization = null, $industry = null, $city = null, $country = null, $state = null, $zip = null, $publicListID = null, $listName = null, $status = ApiTypes\ContactStatus::Active, $notes = null, $consentDate = null, $consentIP = null, $notifyEmail = null) { + return ApiClient::Request('contact/quickadd', array( + 'emails' => (count($emails) === 0) ? null : join(';', $emails), + 'firstName' => $firstName, + 'lastName' => $lastName, + 'title' => $title, + 'organization' => $organization, + 'industry' => $industry, + 'city' => $city, + 'country' => $country, + 'state' => $state, + 'zip' => $zip, + 'publicListID' => $publicListID, + 'listName' => $listName, + 'status' => $status, + 'notes' => $notes, + 'consentDate' => $consentDate, + 'consentIP' => $consentIP, + 'notifyEmail' => $notifyEmail + )); + } + + /** + * Basic double opt-in email subscribe form for your account. This can be used for contacts that need to re-subscribe as well. + * @param string $publicAccountID Public key for limited access to your account such as contact/add so you can use it safely on public websites. + * @return string + */ + public function Subscribe($publicAccountID) { + return ApiClient::Request('contact/subscribe', array( + 'publicAccountID' => $publicAccountID + )); + } + + /** + * Update selected contact. Omitted contact's fields will be reset by default (see the clearRestOfFields parameter) + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $email Proper email address. + * @param string $firstName First name. + * @param string $lastName Last name. + * @param string $organizationName Name of organization + * @param string $title Title + * @param string $city City. + * @param string $state State or province. + * @param string $country Name of country. + * @param string $zip Zip/postal code. + * @param string $birthDate Date of birth in YYYY-MM-DD format + * @param string $gender Your gender + * @param string $phone Phone number + * @param ?bool $activate True, if Contact should be activated. Otherwise, false + * @param string $industry Industry contact works in + * @param int $numberOfEmployees Number of employees + * @param string $annualRevenue Annual revenue of contact + * @param int $purchaseCount Number of purchases contact has made + * @param string $firstPurchase Date of first purchase in YYYY-MM-DD format + * @param string $lastPurchase Date of last purchase in YYYY-MM-DD format + * @param string $notes Free form field of notes + * @param string $websiteUrl Website of contact + * @param string $mobileNumber Mobile phone number + * @param string $faxNumber Fax number + * @param string $linkedInBio Biography for Linked-In + * @param int $linkedInConnections Number of Linked-In connections + * @param string $twitterBio Biography for Twitter + * @param string $twitterUsername User name for Twitter + * @param string $twitterProfilePhoto URL for Twitter photo + * @param int $twitterFollowerCount Number of Twitter followers + * @param int $pageViews Number of page views + * @param int $visits Number of website visits + * @param bool $clearRestOfFields States if the fields that were omitted in this request are to be reset or should they be left with their current value + * @param array $field Custom contact field like firstname, lastname, city etc. Request parameters prefixed by field_ like field_firstname, field_lastname + * @return ApiTypes\Contact + */ + public function Update($email, $firstName = null, $lastName = null, $organizationName = null, $title = null, $city = null, $state = null, $country = null, $zip = null, $birthDate = null, $gender = null, $phone = null, $activate = null, $industry = null, $numberOfEmployees = 0, $annualRevenue = null, $purchaseCount = 0, $firstPurchase = null, $lastPurchase = null, $notes = null, $websiteUrl = null, $mobileNumber = null, $faxNumber = null, $linkedInBio = null, $linkedInConnections = 0, $twitterBio = null, $twitterUsername = null, $twitterProfilePhoto = null, $twitterFollowerCount = 0, $pageViews = 0, $visits = 0, $clearRestOfFields = true, array $field = array()) { + $arr = array('email' => $email, + 'firstName' => $firstName, + 'lastName' => $lastName, + 'organizationName' => $organizationName, + 'title' => $title, + 'city' => $city, + 'state' => $state, + 'country' => $country, + 'zip' => $zip, + 'birthDate' => $birthDate, + 'gender' => $gender, + 'phone' => $phone, + 'activate' => $activate, + 'industry' => $industry, + 'numberOfEmployees' => $numberOfEmployees, + 'annualRevenue' => $annualRevenue, + 'purchaseCount' => $purchaseCount, + 'firstPurchase' => $firstPurchase, + 'lastPurchase' => $lastPurchase, + 'notes' => $notes, + 'websiteUrl' => $websiteUrl, + 'mobileNumber' => $mobileNumber, + 'faxNumber' => $faxNumber, + 'linkedInBio' => $linkedInBio, + 'linkedInConnections' => $linkedInConnections, + 'twitterBio' => $twitterBio, + 'twitterUsername' => $twitterUsername, + 'twitterProfilePhoto' => $twitterProfilePhoto, + 'twitterFollowerCount' => $twitterFollowerCount, + 'pageViews' => $pageViews, + 'visits' => $visits, + 'clearRestOfFields' => $clearRestOfFields, + ); + foreach(array_keys($field) as $key) { + $arr['field_'.$key] = $field[$key]; + } + return ApiClient::Request('contact/update', $arr); + } + + /** + * Upload contacts in CSV file. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param File $contactFile Name of CSV file with Contacts. + * @param bool $allowUnsubscribe True: Allow unsubscribing from this (optional) newly created list. Otherwise, false + * @param ?int $listID ID number of selected list. + * @param string $listName Name of your list to upload contacts to, or how the new, automatically created list should be named + * @param ApiTypes\ContactStatus $status Name of status: Active, Engaged, Inactive, Abuse, Bounced, Unsubscribed. + * @param ?DateTime $consentDate Date of consent to send this contact(s) your email. If not provided current date is used for consent. + * @param string $consentIP IP address of consent to send this contact(s) your email. If not provided your current public IP address is used for consent. + * @return int + */ + public function Upload($contactFile, $allowUnsubscribe = false, $listID = null, $listName = null, $status = ApiTypes\ContactStatus::Active, $consentDate = null, $consentIP = null) { + return ApiClient::Request('contact/upload', array( + 'allowUnsubscribe' => $allowUnsubscribe, + 'listID' => $listID, + 'listName' => $listName, + 'status' => $status, + 'consentDate' => $consentDate, + 'consentIP' => $consentIP + ), "POST", $contactFile); + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/Domain.php b/src/ElasticEmailClient/Domain.php new file mode 100755 index 0000000..0085ef4 --- /dev/null +++ b/src/ElasticEmailClient/Domain.php @@ -0,0 +1,99 @@ + $domain, + 'trackingType' => $trackingType + )); + } + + /** + * Deletes configured domain from account + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $domain Name of selected domain. + */ + public function EEDelete($domain) { + return ApiClient::Request('domain/delete', array( + 'domain' => $domain + )); + } + + /** + * Lists all domains configured for this account. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return Array + */ + public function EEList() { + return ApiClient::Request('domain/list'); + } + + /** + * Verification of email addres set for domain. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $domain Default email sender, example: mail@yourdomain.com + */ + public function SetDefault($domain) { + return ApiClient::Request('domain/setdefault', array( + 'domain' => $domain + )); + } + + /** + * Verification of DKIM record for domain + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $domain Name of selected domain. + */ + public function VerifyDkim($domain) { + return ApiClient::Request('domain/verifydkim', array( + 'domain' => $domain + )); + } + + /** + * Verification of MX record for domain + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $domain Name of selected domain. + */ + public function VerifyMX($domain) { + return ApiClient::Request('domain/verifymx', array( + 'domain' => $domain + )); + } + + /** + * Verification of SPF record for domain + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $domain Name of selected domain. + */ + public function VerifySpf($domain) { + return ApiClient::Request('domain/verifyspf', array( + 'domain' => $domain + )); + } + + /** + * Verification of tracking CNAME record for domain + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $domain Name of selected domain. + * @param ApiTypes\TrackingType $trackingType + */ + public function VerifyTracking($domain, $trackingType = ApiTypes\TrackingType::Http) { + return ApiClient::Request('domain/verifytracking', array( + 'domain' => $domain, + 'trackingType' => $trackingType + )); + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/EEList.php b/src/ElasticEmailClient/EEList.php new file mode 100755 index 0000000..f550106 --- /dev/null +++ b/src/ElasticEmailClient/EEList.php @@ -0,0 +1,231 @@ + $emails Comma delimited list of contact emails + * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false + * @return int + */ + public function Add($listName, $createEmptyList = false, $allowUnsubscribe = false, $rule = null, array $emails = array(), $allContacts = false) { + return ApiClient::Request('list/add', array( + 'listName' => $listName, + 'createEmptyList' => $createEmptyList, + 'allowUnsubscribe' => $allowUnsubscribe, + 'rule' => $rule, + 'emails' => (count($emails) === 0) ? null : join(';', $emails), + 'allContacts' => $allContacts + )); + } + + /** + * Add existing Contacts to chosen list + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $listName Name of your list. + * @param string $rule Query used for filtering. + * @param array $emails Comma delimited list of contact emails + * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false + */ + public function AddContacts($listName, $rule = null, array $emails = array(), $allContacts = false) { + return ApiClient::Request('list/addcontacts', array( + 'listName' => $listName, + 'rule' => $rule, + 'emails' => (count($emails) === 0) ? null : join(';', $emails), + 'allContacts' => $allContacts + )); + } + + /** + * Copy your existing List with the option to provide new settings to it. Some fields, when left empty, default to the source list's settings + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $sourceListName The name of the list you want to copy + * @param string $newlistName Name of your list if you want to change it. + * @param ?bool $createEmptyList True to create an empty list, otherwise false. Ignores rule and emails parameters if provided. + * @param ?bool $allowUnsubscribe True: Allow unsubscribing from this list. Otherwise, false + * @param string $rule Query used for filtering. + * @return int + */ + public function EECopy($sourceListName, $newlistName = null, $createEmptyList = null, $allowUnsubscribe = null, $rule = null) { + return ApiClient::Request('list/copy', array( + 'sourceListName' => $sourceListName, + 'newlistName' => $newlistName, + 'createEmptyList' => $createEmptyList, + 'allowUnsubscribe' => $allowUnsubscribe, + 'rule' => $rule + )); + } + + /** + * Create a new list from the recipients of the given campaign, using the given statuses of Messages + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $campaignID ID of the campaign which recipients you want to copy + * @param string $listName Name of your list. + * @param array $statuses Statuses of a campaign's emails you want to include in the new list (but NOT the contacts' statuses) + * @return int + */ + public function CreateFromCampaign($campaignID, $listName, array $statuses = array()) { + return ApiClient::Request('list/createfromcampaign', array( + 'campaignID' => $campaignID, + 'listName' => $listName, + 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses) + )); + } + + /** + * Create a series of nth selection lists from an existing list or segment + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $listName Name of your list. + * @param int $numberOfLists The number of evenly distributed lists to create. + * @param bool $excludeBlocked True if you want to exclude contacts that are currently in a blocked status of either unsubscribe, complaint or bounce. Otherwise, false. + * @param bool $allowUnsubscribe True: Allow unsubscribing from this list. Otherwise, false + * @param string $rule Query used for filtering. + * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false + */ + public function CreateNthSelectionLists($listName, $numberOfLists, $excludeBlocked = true, $allowUnsubscribe = false, $rule = null, $allContacts = false) { + return ApiClient::Request('list/createnthselectionlists', array( + 'listName' => $listName, + 'numberOfLists' => $numberOfLists, + 'excludeBlocked' => $excludeBlocked, + 'allowUnsubscribe' => $allowUnsubscribe, + 'rule' => $rule, + 'allContacts' => $allContacts + )); + } + + /** + * Create a new list with randomized contacts from an existing list or segment + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $listName Name of your list. + * @param int $count Number of items. + * @param bool $excludeBlocked True if you want to exclude contacts that are currently in a blocked status of either unsubscribe, complaint or bounce. Otherwise, false. + * @param bool $allowUnsubscribe True: Allow unsubscribing from this list. Otherwise, false + * @param string $rule Query used for filtering. + * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false + * @return int + */ + public function CreateRandomList($listName, $count, $excludeBlocked = true, $allowUnsubscribe = false, $rule = null, $allContacts = false) { + return ApiClient::Request('list/createrandomlist', array( + 'listName' => $listName, + 'count' => $count, + 'excludeBlocked' => $excludeBlocked, + 'allowUnsubscribe' => $allowUnsubscribe, + 'rule' => $rule, + 'allContacts' => $allContacts + )); + } + + /** + * Deletes List and removes all the Contacts from it (does not delete Contacts). + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $listName Name of your list. + */ + public function EEDelete($listName) { + return ApiClient::Request('list/delete', array( + 'listName' => $listName + )); + } + + /** + * Exports all the contacts from the provided list + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $listName Name of your list. + * @param ApiTypes\ExportFileFormats $fileFormat Format of the exported file + * @param ApiTypes\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. + * @param string $fileName Name of your file. + * @return ApiTypes\ExportLink + */ + public function Export($listName, $fileFormat = ApiTypes\ExportFileFormats::Csv, $compressionFormat = ApiTypes\CompressionFormat::None, $fileName = null) { + return ApiClient::Request('list/export', array( + 'listName' => $listName, + 'fileFormat' => $fileFormat, + 'compressionFormat' => $compressionFormat, + 'fileName' => $fileName + )); + } + + /** + * Shows all your existing lists + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param ?DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. + * @param ?DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. + * @return Array + */ + public function EElist($from = null, $to = null) { + return ApiClient::Request('list/list', array( + 'from' => $from, + 'to' => $to + )); + } + + /** + * Returns detailed information about specific list. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $listName Name of your list. + * @return ApiTypes\List + */ + public function Load($listName) { + return ApiClient::Request('list/load', array( + 'listName' => $listName + )); + } + + /** + * Move selected contacts from one List to another + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $oldListName The name of the list from which the contacts will be copied from + * @param string $newListName The name of the list to copy the contacts to + * @param array $emails Comma delimited list of contact emails + * @param ?bool $moveAll TRUE - moves all contacts; FALSE - moves contacts provided in the 'emails' parameter. This is ignored if the 'statuses' parameter has been provided + * @param array $statuses List of contact statuses which are eligible to move. This ignores the 'moveAll' parameter + */ + public function MoveContacts($oldListName, $newListName, array $emails = array(), $moveAll = null, array $statuses = array()) { + return ApiClient::Request('list/movecontacts', array( + 'oldListName' => $oldListName, + 'newListName' => $newListName, + 'emails' => (count($emails) === 0) ? null : join(';', $emails), + 'moveAll' => $moveAll, + 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses) + )); + } + + /** + * Remove selected Contacts from your list + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $listName Name of your list. + * @param string $rule Query used for filtering. + * @param array $emails Comma delimited list of contact emails + */ + public function RemoveContacts($listName, $rule = null, array $emails = array()) { + return ApiClient::Request('list/removecontacts', array( + 'listName' => $listName, + 'rule' => $rule, + 'emails' => (count($emails) === 0) ? null : join(';', $emails) + )); + } + + /** + * Update existing list + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $listName Name of your list. + * @param string $newListName Name of your list if you want to change it. + * @param bool $allowUnsubscribe True: Allow unsubscribing from this list. Otherwise, false + */ + public function Update($listName, $newListName = null, $allowUnsubscribe = false) { + return ApiClient::Request('list/update', array( + 'listName' => $listName, + 'newListName' => $newListName, + 'allowUnsubscribe' => $allowUnsubscribe + )); + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/Email.php b/src/ElasticEmailClient/Email.php new file mode 100755 index 0000000..ed45f32 --- /dev/null +++ b/src/ElasticEmailClient/Email.php @@ -0,0 +1,138 @@ + $transactionID, + 'showFailed' => $showFailed, + 'showSent' => $showSent, + 'showDelivered' => $showDelivered, + 'showPending' => $showPending, + 'showOpened' => $showOpened, + 'showClicked' => $showClicked, + 'showAbuse' => $showAbuse, + 'showUnsubscribed' => $showUnsubscribed, + 'showErrors' => $showErrors, + 'showMessageIDs' => $showMessageIDs + )); + } + + /** + * Submit emails. The HTTP POST request is suggested. The default, maximum (accepted by us) size of an email is 10 MB in total, with or without attachments included. For suggested implementations please refer to https://elasticemail.com/support/http-api/ + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $subject Email subject + * @param string $from From email address + * @param string $fromName Display name for from email address + * @param string $sender Email address of the sender + * @param string $senderName Display name sender + * @param string $msgFrom Optional parameter. Sets FROM MIME header. + * @param string $msgFromName Optional parameter. Sets FROM name of MIME header. + * @param string $replyTo Email address to reply to + * @param string $replyToName Display name of the reply to address + * @param array $to List of email recipients (each email is treated separately, like a BCC). Separated by comma or semicolon. We suggest using the "msgTo" parameter if backward compatibility with API version 1 is not a must. + * @param array $msgTo Optional parameter. Will be ignored if the 'to' parameter is also provided. List of email recipients (visible to all other recipients of the message as TO MIME header). Separated by comma or semicolon. + * @param array $msgCC Optional parameter. Will be ignored if the 'to' parameter is also provided. List of email recipients (visible to all other recipients of the message as CC MIME header). Separated by comma or semicolon. + * @param array $msgBcc Optional parameter. Will be ignored if the 'to' parameter is also provided. List of email recipients (each email is treated seperately). Separated by comma or semicolon. + * @param array $lists The name of a contact list you would like to send to. Separate multiple contact lists by commas or semicolons. + * @param array $segments The name of a segment you would like to send to. Separate multiple segments by comma or semicolon. Insert "0" for all Active contacts. + * @param string $mergeSourceFilename File name one of attachments which is a CSV list of Recipients. + * @param string $channel An ID field (max 191 chars) that can be used for reporting [will default to HTTP API or SMTP API] + * @param string $bodyHtml Html email body + * @param string $bodyText Text email body + * @param string $charset Text value of charset encoding for example: iso-8859-1, windows-1251, utf-8, us-ascii, windows-1250 and moreā€¦ + * @param string $charsetBodyHtml Sets charset for body html MIME part (overrides default value from charset parameter) + * @param string $charsetBodyText Sets charset for body text MIME part (overrides default value from charset parameter) + * @param ApiTypes\EncodingType $encodingType 0 for None, 1 for Raw7Bit, 2 for Raw8Bit, 3 for QuotedPrintable, 4 for Base64 (Default), 5 for Uue note that you can also provide the text version such as "Raw7Bit" for value 1. NOTE: Base64 or QuotedPrintable is recommended if you are validating your domain(s) with DKIM. + * @param string $template The ID of an email template you have created in your account. + * @param array $attachmentFiles Attachment files. These files should be provided with the POST multipart file upload, not directly in the request's URL. Should also include merge CSV file + * @param array $headers Optional Custom Headers. Request parameters prefixed by headers_ like headers_customheader1, headers_customheader2. Note: a space is required after the colon before the custom header value. headers_xmailer=xmailer: header-value1 + * @param string $postBack Optional header returned in notifications. + * @param array $merge Request parameters prefixed by merge_ like merge_firstname, merge_lastname. If sending to a template you can send merge_ fields to merge data with the template. Template fields are entered with {firstname}, {lastname} etc. + * @param string $timeOffSetMinutes Number of minutes in the future this email should be sent + * @param string $poolName Name of your custom IP Pool to be used in the sending process + * @param bool $isTransactional True, if email is transactional (non-bulk, non-marketing, non-commercial). Otherwise, false + * @return ApiTypes\EmailSend + */ + public function Send($subject = null, $from = null, $fromName = null, $sender = null, $senderName = null, $msgFrom = null, $msgFromName = null, $replyTo = null, $replyToName = null, array $to = array(), array $msgTo = array(), array $msgCC = array(), array $msgBcc = array(), array $lists = array(), array $segments = array(), $mergeSourceFilename = null, $channel = null, $bodyHtml = null, $bodyText = null, $charset = null, $charsetBodyHtml = null, $charsetBodyText = null, $encodingType = ApiTypes\EncodingType::None, $template = null, array $attachmentFiles = array(), array $headers = array(), $postBack = null, array $merge = array(), $timeOffSetMinutes = null, $poolName = null, $isTransactional = false) { + $arr = array('subject' => $subject, + 'from' => $from, + 'fromName' => $fromName, + 'sender' => $sender, + 'senderName' => $senderName, + 'msgFrom' => $msgFrom, + 'msgFromName' => $msgFromName, + 'replyTo' => $replyTo, + 'replyToName' => $replyToName, + 'to' => (count($to) === 0) ? null : join(';', $to), + 'msgTo' => (count($msgTo) === 0) ? null : join(';', $msgTo), + 'msgCC' => (count($msgCC) === 0) ? null : join(';', $msgCC), + 'msgBcc' => (count($msgBcc) === 0) ? null : join(';', $msgBcc), + 'lists' => (count($lists) === 0) ? null : join(';', $lists), + 'segments' => (count($segments) === 0) ? null : join(';', $segments), + 'mergeSourceFilename' => $mergeSourceFilename, + 'channel' => $channel, + 'bodyHtml' => $bodyHtml, + 'bodyText' => $bodyText, + 'charset' => $charset, + 'charsetBodyHtml' => $charsetBodyHtml, + 'charsetBodyText' => $charsetBodyText, + 'encodingType' => $encodingType, + 'template' => $template, + 'postBack' => $postBack, + 'timeOffSetMinutes' => $timeOffSetMinutes, + 'poolName' => $poolName, + 'isTransactional' => $isTransactional ); + foreach(array_keys($headers) as $key) { + $arr['headers_'.$key] = $key.': '.$headers[$key]; + } + foreach(array_keys($merge) as $key) { + $arr['merge_'.$key] = $merge[$key]; + } + return ApiClient::Request('email/send', $arr, "POST", $attachmentFiles); + } + + /** + * Detailed status of a unique email sent through your account. Returns a 'Email has expired and the status is unknown.' error, if the email has not been fully processed yet. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $messageID Unique identifier for this email. + * @return ApiTypes\EmailStatus + */ + public function Status($messageID) { + return ApiClient::Request('email/status', array( + 'messageID' => $messageID + )); + } + + /** + * View email + * @param string $messageID Message identifier + * @return ApiTypes\EmailView + */ + public function View($messageID) { + return ApiClient::Request('email/view', array( + 'messageID' => $messageID + )); + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/Export.php b/src/ElasticEmailClient/Export.php new file mode 100755 index 0000000..82e4bb2 --- /dev/null +++ b/src/ElasticEmailClient/Export.php @@ -0,0 +1,55 @@ + $publicExportID + )); + } + + /** + * Summary of export type counts. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return ApiTypes\ExportTypeCounts + */ + public function CountByType() { + return ApiClient::Request('export/countbytype'); + } + + /** + * Delete the specified export. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param Guid $publicExportID + */ + public function EEDelete($publicExportID) { + return ApiClient::Request('export/delete', array( + 'publicExportID' => $publicExportID + )); + } + + /** + * Returns a list of all exported data. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @return Array + */ + public function EEList($limit = 0, $offset = 0) { + return ApiClient::Request('export/list', array( + 'limit' => $limit, + 'offset' => $offset + )); + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/Log.php b/src/ElasticEmailClient/Log.php new file mode 100755 index 0000000..4b087b1 --- /dev/null +++ b/src/ElasticEmailClient/Log.php @@ -0,0 +1,193 @@ + $channelName, + 'transactionID' => $transactionID + )); + } + + /** + * Export email log information to the specified file format. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param array $statuses List of comma separated message statuses: 0 for all, 1 for ReadyToSend, 2 for InProgress, 4 for Bounced, 5 for Sent, 6 for Opened, 7 for Clicked, 8 for Unsubscribed, 9 for Abuse Report + * @param ApiTypes\ExportFileFormats $fileFormat Format of the exported file + * @param ?DateTime $from Start date. + * @param ?DateTime $to End date. + * @param int $channelID ID number of selected Channel. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @param bool $includeEmail True: Search includes emails. Otherwise, false. + * @param bool $includeSms True: Search includes SMS. Otherwise, false. + * @param array $messageCategory ID of message category + * @param ApiTypes\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. + * @param string $fileName Name of your file. + * @param string $email Proper email address. + * @return ApiTypes\ExportLink + */ + public function Export($statuses, $fileFormat = ApiTypes\ExportFileFormats::Csv, $from = null, $to = null, $channelID = 0, $limit = 0, $offset = 0, $includeEmail = true, $includeSms = true, array $messageCategory = array(), $compressionFormat = ApiTypes\CompressionFormat::None, $fileName = null, $email = null) { + return ApiClient::Request('log/export', array( + 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses), + 'fileFormat' => $fileFormat, + 'from' => $from, + 'to' => $to, + 'channelID' => $channelID, + 'limit' => $limit, + 'offset' => $offset, + 'includeEmail' => $includeEmail, + 'includeSms' => $includeSms, + 'messageCategory' => (count($messageCategory) === 0) ? null : join(';', $messageCategory), + 'compressionFormat' => $compressionFormat, + 'fileName' => $fileName, + 'email' => $email + )); + } + + /** + * Export detailed link tracking information to the specified file format. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $channelID ID number of selected Channel. + * @param ?DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. + * @param ?DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. + * @param ApiTypes\ExportFileFormats $fileFormat Format of the exported file + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @param ApiTypes\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. + * @param string $fileName Name of your file. + * @return ApiTypes\ExportLink + */ + public function ExportLinkTracking($channelID, $from, $to, $fileFormat = ApiTypes\ExportFileFormats::Csv, $limit = 0, $offset = 0, $compressionFormat = ApiTypes\CompressionFormat::None, $fileName = null) { + return ApiClient::Request('log/exportlinktracking', array( + 'channelID' => $channelID, + 'from' => $from, + 'to' => $to, + 'fileFormat' => $fileFormat, + 'limit' => $limit, + 'offset' => $offset, + 'compressionFormat' => $compressionFormat, + 'fileName' => $fileName + )); + } + + /** + * Track link clicks + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param ?DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. + * @param ?DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @param string $channelName Name of selected channel. + * @return ApiTypes\LinkTrackingDetails + */ + public function LinkTracking($from = null, $to = null, $limit = 0, $offset = 0, $channelName = null) { + return ApiClient::Request('log/linktracking', array( + 'from' => $from, + 'to' => $to, + 'limit' => $limit, + 'offset' => $offset, + 'channelName' => $channelName + )); + } + + /** + * Returns logs filtered by specified parameters. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param array $statuses List of comma separated message statuses: 0 for all, 1 for ReadyToSend, 2 for InProgress, 4 for Bounced, 5 for Sent, 6 for Opened, 7 for Clicked, 8 for Unsubscribed, 9 for Abuse Report + * @param ?DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. + * @param ?DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. + * @param string $channelName Name of selected channel. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @param bool $includeEmail True: Search includes emails. Otherwise, false. + * @param bool $includeSms True: Search includes SMS. Otherwise, false. + * @param array $messageCategory ID of message category + * @param string $email Proper email address. + * @param bool $useStatusChangeDate True, if 'from' and 'to' parameters should resolve to the Status Change date. To resolve to the creation date - false + * @return ApiTypes\Log + */ + public function Load($statuses, $from = null, $to = null, $channelName = null, $limit = 0, $offset = 0, $includeEmail = true, $includeSms = true, array $messageCategory = array(), $email = null, $useStatusChangeDate = false) { + return ApiClient::Request('log/load', array( + 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses), + 'from' => $from, + 'to' => $to, + 'channelName' => $channelName, + 'limit' => $limit, + 'offset' => $offset, + 'includeEmail' => $includeEmail, + 'includeSms' => $includeSms, + 'messageCategory' => (count($messageCategory) === 0) ? null : join(';', $messageCategory), + 'email' => $email, + 'useStatusChangeDate' => $useStatusChangeDate + )); + } + + /** + * Returns notification logs filtered by specified parameters. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param array $statuses List of comma separated message statuses: 0 for all, 1 for ReadyToSend, 2 for InProgress, 4 for Bounced, 5 for Sent, 6 for Opened, 7 for Clicked, 8 for Unsubscribed, 9 for Abuse Report + * @param ?DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. + * @param ?DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @param array $messageCategory ID of message category + * @param bool $useStatusChangeDate True, if 'from' and 'to' parameters should resolve to the Status Change date. To resolve to the creation date - false + * @param ApiTypes\NotificationType $notificationType + * @return ApiTypes\Log + */ + public function LoadNotifications($statuses, $from = null, $to = null, $limit = 0, $offset = 0, array $messageCategory = array(), $useStatusChangeDate = false, $notificationType = ApiTypes\NotificationType::All) { + return ApiClient::Request('log/loadnotifications', array( + 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses), + 'from' => $from, + 'to' => $to, + 'limit' => $limit, + 'offset' => $offset, + 'messageCategory' => (count($messageCategory) === 0) ? null : join(';', $messageCategory), + 'useStatusChangeDate' => $useStatusChangeDate, + 'notificationType' => $notificationType + )); + } + + /** + * Retry sending of temporarily not delivered message. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $msgID ID number of selected message. + */ + public function RetryNow($msgID) { + return ApiClient::Request('log/retrynow', array( + 'msgID' => $msgID + )); + } + + /** + * Loads summary information about activity in chosen date range. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. + * @param DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. + * @param string $channelName Name of selected channel. + * @param ApiTypes\IntervalType $interval 'Hourly' for detailed information, 'summary' for daily overview + * @param string $transactionID ID number of transaction + * @return ApiTypes\LogSummary + */ + public function Summary($from, $to, $channelName = null, $interval = ApiTypes\IntervalType::Summary, $transactionID = null) { + return ApiClient::Request('log/summary', array( + 'from' => $from, + 'to' => $to, + 'channelName' => $channelName, + 'interval' => $interval, + 'transactionID' => $transactionID + )); + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/SMS.php b/src/ElasticEmailClient/SMS.php new file mode 100755 index 0000000..da99e49 --- /dev/null +++ b/src/ElasticEmailClient/SMS.php @@ -0,0 +1,22 @@ + $to, + 'body' => $body + )); + } + +} diff --git a/src/ElasticEmailClient/Segment.php b/src/ElasticEmailClient/Segment.php new file mode 100755 index 0000000..10e5b74 --- /dev/null +++ b/src/ElasticEmailClient/Segment.php @@ -0,0 +1,118 @@ + $segmentName, + 'rule' => $rule + )); + } + + /** + * Copy your existing Segment with the optional new rule and custom name + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $sourceSegmentName The name of the segment you want to copy + * @param string $newSegmentName New name of your segment if you want to change it. + * @param string $rule Query used for filtering. + * @return ApiTypes\Segment + */ + public function EECopy($sourceSegmentName, $newSegmentName = null, $rule = null) { + return ApiClient::Request('segment/copy', array( + 'sourceSegmentName' => $sourceSegmentName, + 'newSegmentName' => $newSegmentName, + 'rule' => $rule + )); + } + + /** + * Delete existing segment. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $segmentName Name of your segment. + */ + public function EEDelete($segmentName) { + return ApiClient::Request('segment/delete', array( + 'segmentName' => $segmentName + )); + } + + /** + * Exports all the contacts from the provided segment + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $segmentName Name of your segment. + * @param ApiTypes\ExportFileFormats $fileFormat Format of the exported file + * @param ApiTypes\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. + * @param string $fileName Name of your file. + * @return ApiTypes\ExportLink + */ + public function Export($segmentName, $fileFormat = ApiTypes\ExportFileFormats::Csv, $compressionFormat = ApiTypes\CompressionFormat::None, $fileName = null) { + return ApiClient::Request('segment/export', array( + 'segmentName' => $segmentName, + 'fileFormat' => $fileFormat, + 'compressionFormat' => $compressionFormat, + 'fileName' => $fileName + )); + } + + /** + * Lists all your available Segments + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param bool $includeHistory True: Include history of last 30 days. Otherwise, false. + * @param ?DateTime $from From what date should the segment history be shown. In YYYY-MM-DDThh:mm:ss format. + * @param ?DateTime $to To what date should the segment history be shown. In YYYY-MM-DDThh:mm:ss format. + * @return Array + */ + public function EEList($includeHistory = false, $from = null, $to = null) { + return ApiClient::Request('segment/list', array( + 'includeHistory' => $includeHistory, + 'from' => $from, + 'to' => $to + )); + } + + /** + * Lists your available Segments using the provided names + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param array $segmentNames Names of segments you want to load. Will load all contacts if left empty or the 'All Contacts' name has been provided + * @param bool $includeHistory True: Include history of last 30 days. Otherwise, false. + * @param ?DateTime $from From what date should the segment history be shown. In YYYY-MM-DDThh:mm:ss format. + * @param ?DateTime $to To what date should the segment history be shown. In YYYY-MM-DDThh:mm:ss format. + * @return Array + */ + public function LoadByName($segmentNames, $includeHistory = false, $from = null, $to = null) { + return ApiClient::Request('segment/loadbyname', array( + 'segmentNames' => (count($segmentNames) === 0) ? null : join(';', $segmentNames), + 'includeHistory' => $includeHistory, + 'from' => $from, + 'to' => $to + )); + } + + /** + * Rename or change RULE for your segment + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $segmentName Name of your segment. + * @param string $newSegmentName New name of your segment if you want to change it. + * @param string $rule Query used for filtering. + * @return ApiTypes\Segment + */ + public function Update($segmentName, $newSegmentName = null, $rule = null) { + return ApiClient::Request('segment/update', array( + 'segmentName' => $segmentName, + 'newSegmentName' => $newSegmentName, + 'rule' => $rule + )); + } + +} diff --git a/src/ElasticEmailClient/Survey.php b/src/ElasticEmailClient/Survey.php new file mode 100755 index 0000000..47fbe2c --- /dev/null +++ b/src/ElasticEmailClient/Survey.php @@ -0,0 +1,95 @@ + $survey + )); + } + + /** + * Deletes the survey + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param Guid $publicSurveyID Survey identifier + */ + public function EEDelete($publicSurveyID) { + return ApiClient::Request('survey/delete', array( + 'publicSurveyID' => $publicSurveyID + )); + } + + /** + * Export given survey's data to provided format + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param Guid $publicSurveyID Survey identifier + * @param string $fileName Name of your file. + * @param ApiTypes\ExportFileFormats $fileFormat Format of the exported file + * @param ApiTypes\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. + * @return ApiTypes\ExportLink + */ + public function Export($publicSurveyID, $fileName, $fileFormat = ApiTypes\ExportFileFormats::Csv, $compressionFormat = ApiTypes\CompressionFormat::None) { + return ApiClient::Request('survey/export', array( + 'publicSurveyID' => $publicSurveyID, + 'fileName' => $fileName, + 'fileFormat' => $fileFormat, + 'compressionFormat' => $compressionFormat + )); + } + + /** + * Shows all your existing surveys + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @return Array + */ + public function EEList() { + return ApiClient::Request('survey/list'); + } + + /** + * Get list of personal answers for the specific survey + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param Guid $publicSurveyID Survey identifier + * @return Array + */ + public function LoadResponseList($publicSurveyID) { + return ApiClient::Request('survey/loadresponselist', array( + 'publicSurveyID' => $publicSurveyID + )); + } + + /** + * Get general results of the specific survey + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param Guid $publicSurveyID Survey identifier + * @return ApiTypes\SurveyResultsSummaryInfo + */ + public function LoadResults($publicSurveyID) { + return ApiClient::Request('survey/loadresults', array( + 'publicSurveyID' => $publicSurveyID + )); + } + + /** + * Update the survey information + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param ApiTypes\Survey $survey Json representation of a survey + * @return ApiTypes\Survey + */ + public function Update($survey) { + return ApiClient::Request('survey/update', array( + 'survey' => $survey + )); + } + +} \ No newline at end of file diff --git a/src/ElasticEmailClient/Template.php b/src/ElasticEmailClient/Template.php new file mode 100755 index 0000000..83927a4 --- /dev/null +++ b/src/ElasticEmailClient/Template.php @@ -0,0 +1,176 @@ + $templateType, + 'templateName' => $templateName, + 'subject' => $subject, + 'fromEmail' => $fromEmail, + 'fromName' => $fromName, + 'templateScope' => $templateScope, + 'bodyHtml' => $bodyHtml, + 'bodyText' => $bodyText, + 'css' => $css, + 'originalTemplateID' => $originalTemplateID + )); + } + + /** + * Check if template is used by campaign. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $templateID ID number of template. + * @return bool + */ + public function CheckUsage($templateID) { + return ApiClient::Request('template/checkusage', array( + 'templateID' => $templateID + )); + } + + /** + * Copy Selected Template + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $templateID ID number of template. + * @param string $templateName Name of template. + * @param string $subject Default subject of email. + * @param string $fromEmail Default From: email address. + * @param string $fromName Default From: name. + * @return ApiTypes\Template + */ + public function EECopy($templateID, $templateName, $subject, $fromEmail, $fromName) { + return ApiClient::Request('template/copy', array( + 'templateID' => $templateID, + 'templateName' => $templateName, + 'subject' => $subject, + 'fromEmail' => $fromEmail, + 'fromName' => $fromName + )); + } + + /** + * Delete template with the specified ID + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $templateID ID number of template. + */ + public function EEDelete($templateID) { + return ApiClient::Request('template/delete', array( + 'templateID' => $templateID + )); + } + + /** + * Search for references to images and replaces them with base64 code. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $templateID ID number of template. + * @return string + */ + public function GetEmbeddedHtml($templateID) { + return ApiClient::Request('template/getembeddedhtml', array( + 'templateID' => $templateID + )); + } + + /** + * Lists your templates + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $limit Maximum of loaded items. + * @param int $offset How many items should be loaded ahead. + * @return ApiTypes\TemplateList + */ + public function GetList($limit = 500, $offset = 0) { + return ApiClient::Request('template/getlist', array( + 'limit' => $limit, + 'offset' => $offset + )); + } + + /** + * Load template with content + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $templateID ID number of template. + * @param bool $ispublic + * @return ApiTypes\Template + */ + public function LoadTemplate($templateID, $ispublic = false) { + return ApiClient::Request('template/loadtemplate', array( + 'templateID' => $templateID, + 'ispublic' => $ispublic + )); + } + + /** + * Removes previously generated screenshot of template + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $templateID ID number of template. + */ + public function RemoveScreenshot($templateID) { + return ApiClient::Request('template/removescreenshot', array( + 'templateID' => $templateID + )); + } + + /** + * Saves screenshot of chosen Template + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param string $base64Image Image, base64 coded. + * @param int $templateID ID number of template. + * @return string + */ + public function SaveScreenshot($base64Image, $templateID) { + return ApiClient::Request('template/savescreenshot', array( + 'base64Image' => $base64Image, + 'templateID' => $templateID + )); + } + + /** + * Update existing template, overwriting existing data. Needs to be sent using POST method. + * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. + * @param int $templateID ID number of template. + * @param ApiTypes\TemplateScope $templateScope Enum: 0 - private, 1 - public, 2 - mockup + * @param string $templateName Name of template. + * @param string $subject Default subject of email. + * @param string $fromEmail Default From: email address. + * @param string $fromName Default From: name. + * @param string $bodyHtml HTML code of email (needs escaping). + * @param string $bodyText Text body of email. + * @param string $css CSS style + * @param bool $removeScreenshot + */ + public function Update($templateID, $templateScope = ApiTypes\TemplateScope::EEPrivate, $templateName = null, $subject = null, $fromEmail = null, $fromName = null, $bodyHtml = null, $bodyText = null, $css = null, $removeScreenshot = true) { + return ApiClient::Request('template/update', array( + 'templateID' => $templateID, + 'templateScope' => $templateScope, + 'templateName' => $templateName, + 'subject' => $subject, + 'fromEmail' => $fromEmail, + 'fromName' => $fromName, + 'bodyHtml' => $bodyHtml, + 'bodyText' => $bodyText, + 'css' => $css, + 'removeScreenshot' => $removeScreenshot + )); + } + +} \ No newline at end of file