-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #324 from zendesk/kcasas/MI-1528-helpcenter-articl…
…es-search [MI-1528] HelpCenter Articles Search
- Loading branch information
Showing
4 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Zendesk\API\Traits\Resource; | ||
|
||
use Zendesk\API\Exceptions\RouteException; | ||
|
||
trait Search | ||
{ | ||
/** | ||
* Used to access the search endpoint of Resources | ||
* | ||
* @param array $params query parameters | ||
* @return null|\stdClass | ||
*/ | ||
public function search(array $params) | ||
{ | ||
try { | ||
$route = $this->getRoute(__FUNCTION__, $params); | ||
} catch (RouteException $e) { | ||
if (! isset($this->resourceName)) { | ||
$this->resourceName = $this->getResourceNameFromClass(); | ||
} | ||
|
||
$route = $this->resourceName . '/search.json'; | ||
$this->setRoute(__FUNCTION__, $route); | ||
} | ||
|
||
return $this->client->get($route, $params); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters