mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-03 07:04:07 +01:00
* [ADD] API module. Work in progress.
* [MOD] Removed legacy code.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user