From 1f7d453ffcbb5275e57319442cba0debe13dc73f Mon Sep 17 00:00:00 2001 From: JorisDebonnet Date: Thu, 10 Oct 2019 03:35:39 +0200 Subject: [PATCH] Add support for delete endpoint --- src/SendyPHP.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/SendyPHP.php b/src/SendyPHP.php index 65d243a..312a349 100644 --- a/src/SendyPHP.php +++ b/src/SendyPHP.php @@ -106,6 +106,36 @@ public function unsubscribe($email) } } + public function delete($email) + { + //Note: only supported in Sendy version 2.1.1.4 and above + $type = 'api/subscribers/delete.php'; + + //Send the request to delete + $result = $this->buildAndSend($type, array( + 'api_key' => $this->api_key, + 'list_id' => $this->list_id, + 'email' => $email + )); + + //Handle the results + switch ($result) { + case '1': + return array( + 'status' => true, + 'message' => 'Deleted' + ); + break; + + default: + return array( + 'status' => false, + 'message' => $result + ); + break; + } + } + public function substatus($email) { $type = 'api/subscribers/subscription-status.php';