mirror of
https://github.com/anikeen-com/id.git
synced 2026-03-13 13:46:13 +00:00
28 lines
583 B
PHP
28 lines
583 B
PHP
<?php
|
|
|
|
|
|
namespace Anikeen\Id\Concerns;
|
|
|
|
use Anikeen\Id\ApiOperations\Get;
|
|
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;
|
|
}
|
|
} |