Use a standardized transformer base; replace all client transformers to call that base
This commit is contained in:
parent
2203a4d87e
commit
cf500a1a54
25 changed files with 255 additions and 379 deletions
|
@ -3,30 +3,24 @@
|
|||
namespace Pterodactyl\Transformers\Api\Client;
|
||||
|
||||
use Pterodactyl\Models\PersonalAccessToken;
|
||||
use Pterodactyl\Transformers\Api\Transformer;
|
||||
|
||||
class PersonalAccessTokenTransformer extends BaseClientTransformer
|
||||
class PersonalAccessTokenTransformer extends Transformer
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
return PersonalAccessToken::RESOURCE_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Pterodactyl\Models\PersonalAccessToken $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(PersonalAccessToken $model): array
|
||||
{
|
||||
return [
|
||||
'token_id' => $model->token_id,
|
||||
'description' => $model->description,
|
||||
'abilities' => $model->abilities ?? [],
|
||||
'last_used_at' => $model->last_used_at ? $model->last_used_at->toIso8601String() : null,
|
||||
'created_at' => $model->created_at->toIso8601String(),
|
||||
'updated_at' => $model->updated_at->toIso8601String(),
|
||||
'last_used_at' => self::formatTimestamp($model->last_used_at),
|
||||
'created_at' => self::formatTimestamp($model->created_at),
|
||||
'updated_at' => self::formatTimestamp($model->updated_at),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue