From b52a04c32c01bffea78106927cd42ab7227e11bd Mon Sep 17 00:00:00 2001 From: Justinas Liubinskas Date: Tue, 19 Apr 2016 19:04:46 +0300 Subject: [PATCH] option to send autoresponders true/false --- src/MailerLite/Subscribers.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/MailerLite/Subscribers.php b/src/MailerLite/Subscribers.php index 1a023d0..d759ce0 100644 --- a/src/MailerLite/Subscribers.php +++ b/src/MailerLite/Subscribers.php @@ -4,6 +4,8 @@ class Subscribers extends Base\Rest { + public $autoresponders = null; + public function __construct($apiKey) { $this->name = 'subscribers'; @@ -13,6 +15,13 @@ public function __construct($apiKey) public function add($subscriber = null, $resubscribe = 0) { $subscriber['resubscribe'] = $resubscribe; + + if (is_null($this->autoresponders)) { + $this->autoresponders = true; + } + + $subscriber['autoresponders'] = $this->autoresponders; + return $this->execute('POST', $subscriber); } @@ -20,6 +29,13 @@ function addAll($subscribers, $resubscribe = 0) { $data['resubscribe'] = $resubscribe; $data['subscribers'] = $subscribers; + + if (is_null($this->autoresponders)) { + $this->autoresponders = false; + } + + $data['autoresponders'] = $this->autoresponders; + $this->path .= 'import/'; return $this->execute('POST', $data); } @@ -55,4 +71,10 @@ public function unsubscribe($email) return $result; } + public function setAutoresponders($autoresponders = true) + { + $this->autoresponders = $autoresponders; + + return $this; + } }