Files
id/src/Id/Concerns/ManagesSshKeys.php
Maurice Preuß (envoyr) 1d2119a32b update resources
Signed-off-by: Maurice Preuß (envoyr) <hello@envoyr.com>
2025-05-02 06:27:53 +02:00

29 lines
643 B
PHP

<?php
namespace Anikeen\Id\Concerns;
use Anikeen\Id\ApiOperations\Get;
use Anikeen\Id\Exceptions\RequestRequiresClientIdException;
use Anikeen\Id\Resources\SshKeys;
use Throwable;
trait ManagesSshKeys
{
use Get;
/**
* Get currently authed user with Bearer Token.
*
* @throws Throwable
*/
public function sshKeysByUserId(string $sskKeyId): SshKeys
{
if (!isset($this->sshKeysCache)) {
$this->sshKeysCache = SshKeys::builder(fn() => $this->get(sprintf('v1/users/%s/ssh-keys/json', $sskKeyId)))
->setParent($this);
}
return $this->sshKeysCache;
}
}