2016-01-12 06:05:44 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Routes;
|
|
|
|
|
|
|
|
use Pterodactyl\Models;
|
|
|
|
use Illuminate\Routing\Router;
|
|
|
|
|
|
|
|
class APIRoutes
|
|
|
|
{
|
|
|
|
|
|
|
|
public function map(Router $router) {
|
|
|
|
|
|
|
|
app('Dingo\Api\Auth\Auth')->extend('jwt', function ($app) {
|
|
|
|
return new \Dingo\Api\Auth\Provider\JWT($app['Tymon\JWTAuth\JWTAuth']);
|
|
|
|
});
|
|
|
|
|
|
|
|
$api = app('Dingo\Api\Routing\Router');
|
|
|
|
|
|
|
|
$api->version('v1', function ($api) {
|
|
|
|
$api->post('auth/login', [
|
|
|
|
'as' => 'api.auth.login',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\AuthController@postLogin'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$api->post('auth/validate', [
|
|
|
|
'middleware' => 'api.auth',
|
|
|
|
'as' => 'api.auth.validate',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\AuthController@postValidate'
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
$api->version('v1', ['middleware' => 'api.auth'], function ($api) {
|
|
|
|
$api->get('users', [
|
2016-01-13 03:59:34 +00:00
|
|
|
'as' => 'api.users',
|
2016-01-12 06:05:44 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\UserController@getUsers'
|
|
|
|
]);
|
|
|
|
|
2016-01-13 04:43:33 +00:00
|
|
|
$api->post('users', [
|
|
|
|
'as' => 'api.users.post',
|
2016-01-15 04:13:26 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\UserController@postUser'
|
2016-01-13 04:43:33 +00:00
|
|
|
]);
|
|
|
|
|
2016-01-13 03:59:34 +00:00
|
|
|
$api->get('users/{id}/{fields?}', [
|
|
|
|
'as' => 'api.users.view',
|
2016-01-15 04:13:26 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\UserController@getUser'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$api->patch('users/{id}/', [
|
|
|
|
'as' => 'api.users.patch',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\UserController@patchUser'
|
2016-01-13 03:59:34 +00:00
|
|
|
]);
|
2016-01-12 06:05:44 +00:00
|
|
|
|
2016-01-15 04:13:26 +00:00
|
|
|
$api->delete('users/{id}/', [
|
|
|
|
'as' => 'api.users.delete',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\UserController@deleteUser'
|
|
|
|
]);
|
2016-01-12 06:05:44 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|