mirror of
https://github.com/anikeen-com/id.git
synced 2026-03-15 14:46:15 +00:00
update resources
Signed-off-by: Maurice Preuß (envoyr) <hello@envoyr.com>
This commit is contained in:
@@ -3,9 +3,8 @@
|
||||
namespace Anikeen\Id\Resources;
|
||||
|
||||
use Anikeen\Id\Concerns\HasParent;
|
||||
use Anikeen\Id\Exceptions\RequestRequiresClientIdException;
|
||||
use Anikeen\Id\Result;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Throwable;
|
||||
|
||||
class SshKeys extends BaseCollection
|
||||
{
|
||||
@@ -16,12 +15,11 @@ class SshKeys extends BaseCollection
|
||||
*
|
||||
* @param string $publicKey The public key to be added
|
||||
* @param string|null $name The name of the key (optional)
|
||||
* @throws RequestRequiresClientIdException
|
||||
* @throws GuzzleException
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function create(string $publicKey, ?string $name = null): SshKey
|
||||
{
|
||||
return (new SshKey($this->parent->post('v1/ssh-keys', [
|
||||
return (new SshKey(fn() => $this->parent->post('v1/ssh-keys', [
|
||||
'public_key' => $publicKey,
|
||||
'name' => $name,
|
||||
])))->setParent($this->parent);
|
||||
@@ -32,12 +30,6 @@ class SshKeys extends BaseCollection
|
||||
*/
|
||||
public function find(string $id): ?SshKey
|
||||
{
|
||||
/** @var Result $result */
|
||||
$result = $this->parent->get(sprintf('v1/ssh-keys/%s', $id));
|
||||
|
||||
return $result->success()
|
||||
? (new SshKey($result))
|
||||
->setParent($this->parent)
|
||||
: null;
|
||||
return (new SshKey(fn() => $this->parent->get(sprintf('v1/ssh-keys/%s', $id))));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user