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