From d263a3d6b422a63a396b9cf57a7b257dbe3090e5 Mon Sep 17 00:00:00 2001 From: Michael Wille Date: Fri, 23 Sep 2016 15:17:20 +0200 Subject: [PATCH 1/2] fixed response constructor - if data is null instead an empty array --- src/Snowcap/Emarsys/Response.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Snowcap/Emarsys/Response.php b/src/Snowcap/Emarsys/Response.php index 1d23cd4..42a6e6f 100644 --- a/src/Snowcap/Emarsys/Response.php +++ b/src/Snowcap/Emarsys/Response.php @@ -34,13 +34,13 @@ class Response */ function __construct(array $result = array()) { - if (!isset($result['replyCode']) || !isset($result['replyText']) || !isset($result['data'])) { + if (!isset($result['replyCode']) || !isset($result['replyText']) || !array_key_exists('data', $result)) { throw new ClientException('Invalid result structure'); } $this->replyCode = $result['replyCode']; $this->replyText = $result['replyText']; - $this->data = $result['data']; + $this->data = (array) $result['data']; } /** From cb73796f126bdc55552c228a3041f1a4538ee688 Mon Sep 17 00:00:00 2001 From: Michael Wille Date: Fri, 23 Sep 2016 15:20:41 +0200 Subject: [PATCH 2/2] added new endpoint email/unsubscribe --- src/Snowcap/Emarsys/Client.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Snowcap/Emarsys/Client.php b/src/Snowcap/Emarsys/Client.php index c89488e..349a7e0 100644 --- a/src/Snowcap/Emarsys/Client.php +++ b/src/Snowcap/Emarsys/Client.php @@ -536,6 +536,17 @@ public function getEmailResponses(array $data) return $this->send(HttpClient::POST, 'email/getresponses', $data); } + /** + * Count the unsubscription statistics of a specific campaign. + * + * @param array $data + * @return Response + */ + public function setEmailUnsubscriptionCount(array $data) + { + return $this->send(HttpClient::POST, 'email/unsubscribe', $data); + } + /** * Returns a list of email categories which can be used in email creation. *