2020-03-23 01:15:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Transformers\Api\Client;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\ApiKey;
|
2022-12-15 00:05:46 +00:00
|
|
|
use Pterodactyl\Transformers\Api\Transformer;
|
2020-03-23 01:15:38 +00:00
|
|
|
|
2022-12-15 00:05:46 +00:00
|
|
|
class ApiKeyTransformer extends Transformer
|
2020-03-23 01:15:38 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getResourceName(): string
|
|
|
|
{
|
|
|
|
return ApiKey::RESOURCE_NAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Transform this model into a representation that can be consumed by a client.
|
|
|
|
*/
|
2022-10-14 16:59:20 +00:00
|
|
|
public function transform(ApiKey $model): array
|
2020-03-23 01:15:38 +00:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
'identifier' => $model->identifier,
|
|
|
|
'description' => $model->memo,
|
|
|
|
'allowed_ips' => $model->allowed_ips,
|
2022-10-14 16:59:20 +00:00
|
|
|
'last_used_at' => $model->last_used_at ? $model->last_used_at->toAtomString() : null,
|
|
|
|
'created_at' => $model->created_at->toAtomString(),
|
2020-03-23 01:15:38 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|