|
@@ 22-35 (lines=14) @@
|
| 19 |
|
$this->lists = $lists; |
| 20 |
|
} |
| 21 |
|
|
| 22 |
|
public function subscribe(string $email, array $mergeFields = [], string $listName = '', array $options = []) |
| 23 |
|
{ |
| 24 |
|
$list = $this->lists->findByName($listName); |
| 25 |
|
|
| 26 |
|
$options = $this->getSubscriptionOptions($email, $mergeFields, $options); |
| 27 |
|
|
| 28 |
|
$response = $this->mailChimp->post("lists/{$list->getId()}/members", $options); |
| 29 |
|
|
| 30 |
|
if (! $this->lastActionSucceeded()) { |
| 31 |
|
return false; |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
return $response; |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
public function subscribePending(string $email, array $mergeFields = [], string $listName = '', array $options = []) |
| 38 |
|
{ |
|
@@ 44-57 (lines=14) @@
|
| 41 |
|
return $this->subscribe($email, $mergeFields, $listName, $options); |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
public function subscribeOrUpdate(string $email, array $mergeFields = [], string $listName = '', array $options = []) |
| 45 |
|
{ |
| 46 |
|
$list = $this->lists->findByName($listName); |
| 47 |
|
|
| 48 |
|
$options = $this->getSubscriptionOptions($email, $mergeFields, $options); |
| 49 |
|
|
| 50 |
|
$response = $this->mailChimp->put("lists/{$list->getId()}/members/{$this->getSubscriberHash($email)}", $options); |
| 51 |
|
|
| 52 |
|
if (! $this->lastActionSucceeded()) { |
| 53 |
|
return false; |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
return $response; |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
public function getMembers(string $listName = '', array $parameters = []) |
| 60 |
|
{ |