* [ADD] API module. Work in progress.

* [MOD] Removed legacy code.
This commit is contained in:
nuxsmin
2018-03-13 23:26:43 +01:00
parent 4fc931cbe5
commit 47341d6dbb
105 changed files with 245 additions and 18911 deletions

View File

@@ -26,12 +26,13 @@ namespace SP\Modules\Api\Controllers;
use DI\Container;
use Klein\Klein;
use SP\Api\ApiResponse;
use SP\Api\JsonRpcResponse;
use SP\Core\Context\StatelessContext;
use SP\Core\Events\EventDispatcher;
use SP\Core\Exceptions\SPException;
use SP\Services\Api\ApiRequest;
use SP\Services\Api\ApiResponse;
use SP\Services\Api\ApiService;
use SP\Services\Api\JsonRpcResponse;
/**
* Class ControllerBase
@@ -76,21 +77,20 @@ abstract class ControllerBase
/**
* Constructor
*
* @param Container $container
* @param string $actionName
* @param mixed $requesData
* @param Container $container
* @param string $actionName
* @param ApiRequest $apiRequest
* @throws \DI\DependencyException
* @throws \DI\NotFoundException
*/
public final function __construct(Container $container, $actionName, $requesData)
public final function __construct(Container $container, $actionName, ApiRequest $apiRequest)
{
$this->dic = $container;
$this->context = $container->get(StatelessContext::class);
$this->eventDispatcher = $container->get(EventDispatcher::class);
$this->router = $container->get(Klein::class);
$this->apiService = $container->get(ApiService::class);
$this->apiService->setRequestData($requesData);
$this->apiService = $container->get(ApiService::class)->setApiRequest($apiRequest);
$this->controllerName = $this->getControllerName();
$this->actionName = $actionName;
@@ -135,7 +135,7 @@ abstract class ControllerBase
*
* {"jsonrpc": "2.0", "result": 19, "id": 3}
*
* @param ApiResponse $apiResponse
* @param \SP\Services\Api\ApiResponse $apiResponse
* @return string La cadena en formato JSON
*/
final protected function returnResponse(ApiResponse $apiResponse)