From 21cab0806e704bd59ca41bb5719793048619c35f Mon Sep 17 00:00:00 2001 From: ziming Date: Sun, 22 Jun 2025 23:40:24 +0800 Subject: [PATCH 1/2] Fix inconsistency in listPeopleEvent method by adding listPeopleEvents --- README.md | 4 ++-- src/Resources/WebsitePeople.php | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5e16704..943804b 100644 --- a/README.md +++ b/README.md @@ -496,7 +496,7 @@ All methods that you will most likely need when building a Crisp integration are * **List Events** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#list-people-events) - * `CrispClient->websitePeople->listPeopleEvent(websiteId, peopleId, pageNumber)` + * `CrispClient->websitePeople->listPeopleEvents(websiteId, peopleId, pageNumber)` *
See Example @@ -505,7 +505,7 @@ All methods that you will most likely need when building a Crisp integration are $peopleId = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; $pageNumber = 1; - CrispClient->websitePeople->listPeopleEvent(websiteId, peopleId, pageNumber); + CrispClient->websitePeople->listPeopleEvents(websiteId, peopleId, pageNumber); ```
diff --git a/src/Resources/WebsitePeople.php b/src/Resources/WebsitePeople.php index 9f1399d..6c08656 100644 --- a/src/Resources/WebsitePeople.php +++ b/src/Resources/WebsitePeople.php @@ -209,6 +209,23 @@ public function addPeopleEvent($websiteId, $peopleId, $data) * @throws ClientExceptionInterface * @throws CrispException */ + public function listPeopleEvents($websiteId, $peopleId, $pageNumber) + { + $result = $this->crisp->get( + "website/$websiteId/people/events/$peopleId/list/$pageNumber" + ); + return $this->formatResponse($result); + } + + /** + * @param string $websiteId + * @param string $peopleId + * @param int $pageNumber + * @return array + * @throws ClientExceptionInterface + * @throws CrispException + */ + #[\Deprecated(message: 'use listPeopleEvents() instead')] public function listPeopleEvent($websiteId, $peopleId, $pageNumber) { $result = $this->crisp->get( From 5637161ef700317ab254c063e17950fc8db3e447 Mon Sep 17 00:00:00 2001 From: ziming Date: Mon, 23 Jun 2025 18:53:42 +0800 Subject: [PATCH 2/2] add = 1 to the $pageNumber argument of listPeopleEvents() too --- src/Resources/WebsitePeople.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/WebsitePeople.php b/src/Resources/WebsitePeople.php index 6c08656..62866c3 100644 --- a/src/Resources/WebsitePeople.php +++ b/src/Resources/WebsitePeople.php @@ -209,7 +209,7 @@ public function addPeopleEvent($websiteId, $peopleId, $data) * @throws ClientExceptionInterface * @throws CrispException */ - public function listPeopleEvents($websiteId, $peopleId, $pageNumber) + public function listPeopleEvents($websiteId, $peopleId, $pageNumber = 1) { $result = $this->crisp->get( "website/$websiteId/people/events/$peopleId/list/$pageNumber"