Skip to content

Commit 961c8ad

Browse files
committed
add method unsubscribeEmails
1 parent bdad015 commit 961c8ad

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/ApiClient.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,29 @@ public function removeEmails($bookID, $emails)
439439
return $this->handleResult($requestResult);
440440
}
441441

442+
/**
443+
* Unsubscribe email addresses from book
444+
*
445+
* @param $bookID
446+
* @param $emails
447+
*
448+
* @return stdClass
449+
*/
450+
public function unsubscribeEmails($bookID, $emails)
451+
{
452+
if (empty($bookID) || empty($emails)) {
453+
return $this->handleError('Empty book id or emails');
454+
}
455+
456+
$data = array(
457+
'emails' => serialize($emails),
458+
);
459+
460+
$requestResult = $this->sendRequest('addressbooks/' . $bookID . '/emails/unsubscribe', 'POST', $data);
461+
462+
return $this->handleResult($requestResult);
463+
}
464+
442465
/**
443466
* Get information about email address from book
444467
*
@@ -1628,4 +1651,4 @@ public function deleteSmsCampaign($campaignID)
16281651

16291652
return $this->handleResult($requestResult);
16301653
}
1631-
}
1654+
}

src/ApiInterface.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ public function addEmails($bookID, $emails);
8282
*/
8383
public function removeEmails($bookID, $emails);
8484

85+
/**
86+
* Unsubscribe email addresses from book
87+
*
88+
* @param $bookID
89+
* @param $emails
90+
*/
91+
public function unsubscribeEmails($bookID, $emails);
92+
8593
/**
8694
* Get information about email from book
8795
*

0 commit comments

Comments
 (0)