Move everything around as needed to get things setup for the client API
This commit is contained in:
parent
8daf97021a
commit
e28973bcae
17 changed files with 199 additions and 46 deletions
30
app/Http/Controllers/Api/Client/ClientApiController.php
Normal file
30
app/Http/Controllers/Api/Client/ClientApiController.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\Api\Application;
|
||||
|
||||
use Illuminate\Container\Container;
|
||||
use Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException;
|
||||
|
||||
abstract class ClientApiController extends ApplicationApiController
|
||||
{
|
||||
/**
|
||||
* Return an instance of an application transformer.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @return \Pterodactyl\Transformers\Api\Client\BaseClientTransformer
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function getTransformer(string $abstract)
|
||||
{
|
||||
/** @var \Pterodactyl\Transformers\Api\Client\BaseClientTransformer $transformer */
|
||||
$transformer = Container::getInstance()->make($abstract);
|
||||
$transformer->setKey($this->request->attributes->get('api_key'));
|
||||
|
||||
if (! $transformer instanceof self) {
|
||||
throw new InvalidTransformerLevelException('Calls to ' . __METHOD__ . ' must return a transformer that is an instance of ' . __CLASS__);
|
||||
}
|
||||
|
||||
return $transformer;
|
||||
}
|
||||
}
|
9
app/Http/Controllers/Api/Client/ClientController.php
Normal file
9
app/Http/Controllers/Api/Client/ClientController.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\Api\Client;
|
||||
|
||||
use Pterodactyl\Http\Controllers\Api\Application\ClientApiController;
|
||||
|
||||
class ClientController extends ClientApiController
|
||||
{
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue