Skip to content

Commit dba767a

Browse files
fix: Ensure types are correct
1 parent abfd00b commit dba767a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/services/Api.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use fostercommerce\klaviyoconnectplus\models\KlaviyoList;
77
use KlaviyoAPI\ApiException;
88
use KlaviyoAPI\KlaviyoAPI;
9+
use KlaviyoAPI\Model\EventCreateQueryV2;
10+
use KlaviyoAPI\Model\ProfileUpsertQuery;
911
use yii\base\Exception;
1012

1113
class Api extends Base
@@ -60,9 +62,9 @@ public function track(string $event, array $profile, ?EventProperties $eventProp
6062
$properties['attributes']['properties'] = $mappedProperties;
6163
}
6264

63-
$this->api?->Events->createEvent([
65+
$this->api?->Events->createEvent(new EventCreateQueryV2([
6466
'data' => $properties,
65-
]);
67+
]));
6668
}
6769

6870
public function identify(array $profile): void
@@ -73,7 +75,7 @@ public function identify(array $profile): void
7375
}
7476

7577
try {
76-
$this->api?->Profiles->createOrUpdateProfile($profile);
78+
$this->api?->Profiles->createOrUpdateProfile(new ProfileUpsertQuery($profile));
7779
} catch (ApiException $e) {
7880
// 409 for a duplicate profile error - if we try track the same person twice, Klaviyo will respond with this.
7981
if ($e->getCode() !== 409) {

0 commit comments

Comments
 (0)