@@ 57-65 (lines=9) @@ | ||
54 | * |
|
55 | * @return Contact|null |
|
56 | */ |
|
57 | public function createContact($email, $firstName, $lastName, $phone = null) |
|
58 | { |
|
59 | $contacts = $this->transformCollection( |
|
60 | $this->post('contacts', ['json' => ['contact' => compact('email', 'firstName', 'lastName', 'phone')]]), |
|
61 | Contact::class |
|
62 | ); |
|
63 | ||
64 | return array_shift($contacts); |
|
65 | } |
|
66 | ||
67 | /** |
|
68 | * Find or create a contact. |
|
@@ 96-104 (lines=9) @@ | ||
93 | * |
|
94 | * @return Contact |
|
95 | */ |
|
96 | public function updateOrCreateContact($email, $firstName, $lastName, $phone) |
|
97 | { |
|
98 | $contacts = $this->transformCollection( |
|
99 | $this->post('contact/sync', ['json' => ['contact' => compact('email', 'firstName', 'lastName', 'phone')]]), |
|
100 | Contact::class |
|
101 | ); |
|
102 | ||
103 | return array_shift($contacts); |
|
104 | } |
|
105 | ||
106 | /** |
|
107 | * Get all automations of a contact. |