@@ 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-62 (lines=19) @@ | ||
41 | return $this->subscribe($email, $mergeFields, $listName, $options); |
|
42 | } |
|
43 | ||
44 | public function subscribeOrUpdate( |
|
45 | string $email, |
|
46 | array $mergeFields = [], |
|
47 | string $listName = '', |
|
48 | array $options = [] |
|
49 | ) { |
|
50 | $list = $this->lists->findByName($listName); |
|
51 | ||
52 | $options = $this->getSubscriptionOptions($email, $mergeFields, $options); |
|
53 | ||
54 | $response = $this->mailChimp->put("lists/{$list->getId()}/members/{$this->getSubscriberHash($email)}", |
|
55 | $options); |
|
56 | ||
57 | if (!$this->lastActionSucceeded()) { |
|
58 | return false; |
|
59 | } |
|
60 | ||
61 | return $response; |
|
62 | } |
|
63 | ||
64 | public function getMembers(string $listName = '', array $parameters = []) |
|
65 | { |