mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 19:37:12 +00:00
Start working on API documentation and token auth (references #5)
This commit is contained in:
23
controllers/OpenApiController.php
Normal file
23
controllers/OpenApiController.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Grocy\Controllers;
|
||||
|
||||
use \Grocy\Services\ApplicationService;
|
||||
|
||||
class OpenApiController extends BaseApiController
|
||||
{
|
||||
public function DocumentationUi(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
return $this->AppContainer->view->render($response, 'apidoc');
|
||||
}
|
||||
|
||||
public function DocumentationSpec(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
$applicationService = new ApplicationService();
|
||||
|
||||
$specJson = json_decode(file_get_contents(__DIR__ . '/../helpers/grocy.openapi.json'));
|
||||
$specJson->info->version = $applicationService->GetInstalledVersion();
|
||||
|
||||
return $this->ApiResponse($specJson);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user