-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Description
When using the IntercomClient->contacts->search and the result has multiple pages, accessing these pages causes the following exception:
Cannot assign null to property Intercom\Types\StartingAfterPaging::$perPage of type int
This is caused because the perPage is not set (or set to null) somewhere while going over the pages.
Code example to replicate the issue. There should be more than 2 contacts to trigger the issue with the example below.
$token = "YOUR TOKEN";
$this->client = new IntercomClient($token);
$query = new SingleFilterSearchRequest(['field' => 'last_seen_at', 'operator' => '<', 'value' => Carbon::now()->getTimestamp()]);
$pagination = new StartingAfterPaging([
"perPage" => 2,
]);
$searchRequest = new SearchRequest([
'query' => $query,
'pagination' => $pagination,
]);
$results = $client->contacts->search($searchRequest);
$all_results = [];
foreach ($results->getPages() as $page) {
$all_results = array_merge($all_results, $page->getItems());
}Metadata
Metadata
Assignees
Labels
No labels