Added support of the onUnknownProfileRespondWithUuid when calling Chrly endpoint

This commit is contained in:
ErickSkrauch
2024-06-11 03:50:10 +02:00
parent 16877d502d
commit 345bc80d05
3 changed files with 58 additions and 61 deletions

View File

@@ -39,12 +39,17 @@ class SkinsSystemApi {
* @return array|null
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function profile(string $username, bool $signed = false): ?array {
$url = "/profile/{$username}";
public function profile(string $username, bool $signed = false, ?string $fallbackUuid = null): ?array {
$query = [];
if ($signed) {
$url .= '?unsigned=false';
$query['unsigned'] = 'false';
}
if ($fallbackUuid !== null) {
$query['onUnknownProfileRespondWithUuid'] = $fallbackUuid;
}
$url = "/profile/{$username}" . empty($query) ? '' : http_build_query($query);
$response = $this->getClient()->request('GET', $this->buildUrl($url));
if ($response->getStatusCode() !== 200) {
return null;