2016-01-12 06:05:44 +00:00
|
|
|
<?php
|
2016-01-20 00:10:39 +00:00
|
|
|
/**
|
2016-01-20 21:05:16 +00:00
|
|
|
* Pterodactyl - Panel
|
2016-01-20 00:10:39 +00:00
|
|
|
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
|
|
|
|
*
|
2016-01-20 20:56:40 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2016-01-20 00:10:39 +00:00
|
|
|
*
|
2016-01-20 20:56:40 +00:00
|
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
|
|
* copies or substantial portions of the Software.
|
2016-01-20 00:10:39 +00:00
|
|
|
*
|
2016-01-20 20:56:40 +00:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
2016-01-20 00:10:39 +00:00
|
|
|
*/
|
2016-01-12 06:05:44 +00:00
|
|
|
namespace Pterodactyl\Http\Routes;
|
|
|
|
|
|
|
|
use Pterodactyl\Models;
|
|
|
|
use Illuminate\Routing\Router;
|
|
|
|
|
|
|
|
class APIRoutes
|
|
|
|
{
|
|
|
|
|
|
|
|
public function map(Router $router) {
|
|
|
|
|
|
|
|
$api = app('Dingo\Api\Routing\Router');
|
|
|
|
$api->version('v1', ['middleware' => 'api.auth'], function ($api) {
|
2016-01-15 22:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* User Routes
|
|
|
|
*/
|
2016-01-12 06:05:44 +00:00
|
|
|
$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-15 22:54:29 +00:00
|
|
|
$api->get('users/{id}', [
|
2016-01-13 03:59:34 +00:00
|
|
|
'as' => 'api.users.view',
|
2016-01-15 04:13:26 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\UserController@getUser'
|
|
|
|
]);
|
|
|
|
|
2016-01-15 22:54:29 +00:00
|
|
|
$api->patch('users/{id}', [
|
2016-01-15 04:13:26 +00:00
|
|
|
'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 22:54:29 +00:00
|
|
|
$api->delete('users/{id}', [
|
2016-01-15 04:13:26 +00:00
|
|
|
'as' => 'api.users.delete',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\UserController@deleteUser'
|
|
|
|
]);
|
2016-01-15 22:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Server Routes
|
|
|
|
*/
|
|
|
|
$api->get('servers', [
|
|
|
|
'as' => 'api.servers',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@getServers'
|
|
|
|
]);
|
|
|
|
|
2016-01-16 05:25:21 +00:00
|
|
|
$api->post('servers', [
|
|
|
|
'as' => 'api.servers.post',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@postServer'
|
|
|
|
]);
|
|
|
|
|
2016-01-15 22:54:29 +00:00
|
|
|
$api->get('servers/{id}', [
|
|
|
|
'as' => 'api.servers.view',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@getServer'
|
|
|
|
]);
|
|
|
|
|
2016-01-16 05:25:21 +00:00
|
|
|
$api->post('servers/{id}/suspend', [
|
|
|
|
'as' => 'api.servers.suspend',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@postServerSuspend'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$api->post('servers/{id}/unsuspend', [
|
|
|
|
'as' => 'api.servers.unsuspend',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@postServerUnsuspend'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$api->delete('servers/{id}/{force?}', [
|
|
|
|
'as' => 'api.servers.delete',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServerController@deleteServer'
|
|
|
|
]);
|
|
|
|
|
2016-01-15 22:54:29 +00:00
|
|
|
/**
|
|
|
|
* Node Routes
|
|
|
|
*/
|
|
|
|
$api->get('nodes', [
|
|
|
|
'as' => 'api.nodes',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\NodeController@getNodes'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$api->post('nodes', [
|
|
|
|
'as' => 'api.nodes.post',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\NodeController@postNode'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$api->get('nodes/{id}', [
|
|
|
|
'as' => 'api.nodes.view',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\NodeController@getNode'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$api->get('nodes/{id}/allocations', [
|
2016-01-16 05:25:21 +00:00
|
|
|
'as' => 'api.nodes.view_allocations',
|
2016-01-15 22:54:29 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\NodeController@getNodeAllocations'
|
|
|
|
]);
|
|
|
|
|
2016-01-16 05:25:21 +00:00
|
|
|
$api->delete('nodes/{id}', [
|
2016-01-16 22:34:07 +00:00
|
|
|
'as' => 'api.nodes.delete',
|
2016-01-16 05:25:21 +00:00
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\NodeController@deleteNode'
|
|
|
|
]);
|
|
|
|
|
2016-01-15 22:54:29 +00:00
|
|
|
/**
|
|
|
|
* Location Routes
|
|
|
|
*/
|
|
|
|
$api->get('locations', [
|
|
|
|
'as' => 'api.locations',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\LocationController@getLocations'
|
|
|
|
]);
|
|
|
|
|
2016-01-16 05:25:21 +00:00
|
|
|
/**
|
|
|
|
* Service Routes
|
|
|
|
*/
|
|
|
|
$api->get('services', [
|
|
|
|
'as' => 'api.services',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServiceController@getServices'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$api->get('services/{id}', [
|
|
|
|
'as' => 'api.services.view',
|
|
|
|
'uses' => 'Pterodactyl\Http\Controllers\API\ServiceController@getService'
|
|
|
|
]);
|
|
|
|
|
2016-01-12 06:05:44 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|