Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/Zendesk/API/Resources/Core/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ protected function setUpRoutes()
$this->setRoutes(
[
'find' => 'search.json',
'count' => 'search/count.json',
'anonymous' => 'portal/search.json'
]
);
Expand Down Expand Up @@ -64,4 +65,30 @@ public function anonymous($query, $queryParams = [])

return $this->client->get($this->getRoute(__FUNCTION__), $queryParams);
}


/**
*
* The search/count API is a unified search API that returns count of tickets, users, and organizations. You can define filters to
* narrow your search results according to resource type, dates, and object properties, such as ticket requester or
* tag.
*
* @param null $query
* @param array $queryParams
*
* @return \stdClass | null
* @throws MissingParametersException
* @throws \Zendesk\API\Exceptions\RouteException
*/
public function count($query = null, array $queryParams = [])
{
if (empty($query)) {
throw new MissingParametersException(__METHOD__, ['query']);
}

$queryParams['query'] = $query;

return $this->client->get($this->getRoute(__FUNCTION__), $queryParams);
}

}