mirror of
https://github.com/SkillDisplay/PHPToolKit.git
synced 2024-11-17 06:06:08 +01:00
parent
3ed3abc0d2
commit
16035774e6
1 changed files with 5 additions and 1 deletions
|
@ -24,6 +24,7 @@ namespace SkillDisplay\PHPToolKit\Api;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
|
use GuzzleHttp\Exception\ClientException;
|
||||||
use GuzzleHttp\Psr7\Request;
|
use GuzzleHttp\Psr7\Request;
|
||||||
use SkillDisplay\PHPToolKit\Configuration\Settings;
|
use SkillDisplay\PHPToolKit\Configuration\Settings;
|
||||||
use SkillDisplay\PHPToolKit\Entity\SkillSet as Entity;
|
use SkillDisplay\PHPToolKit\Entity\SkillSet as Entity;
|
||||||
|
@ -48,13 +49,16 @@ class SkillSet
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getById(int $id): Entity
|
public function getById(int $id, bool $includeFullSkills = false): Entity
|
||||||
{
|
{
|
||||||
if ($id <= 0) {
|
if ($id <= 0) {
|
||||||
throw new \Exception('ID of SkillSet has to be a positive integer.', 1600764811);
|
throw new \Exception('ID of SkillSet has to be a positive integer.', 1600764811);
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = $this->settings->getAPIUrl() . '/api/v1/skillset/' . $id;
|
$url = $this->settings->getAPIUrl() . '/api/v1/skillset/' . $id;
|
||||||
|
if ($includeFullSkills) {
|
||||||
|
$url .= '?includeFullSkills';
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$result = $this->client->send(new Request(
|
$result = $this->client->send(new Request(
|
||||||
'GET',
|
'GET',
|
||||||
|
|
Loading…
Reference in a new issue