2021-06-26 23:23:15 +08:00
|
|
|
<?php
|
|
|
|
|
2023-05-18 00:56:55 +08:00
|
|
|
namespace BookStack\Api;
|
2020-01-13 00:25:14 +08:00
|
|
|
|
2023-05-19 03:53:39 +08:00
|
|
|
use BookStack\Http\ApiController;
|
2020-01-13 00:25:14 +08:00
|
|
|
|
|
|
|
class ApiDocsController extends ApiController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Load the docs page for the API.
|
|
|
|
*/
|
|
|
|
public function display()
|
|
|
|
{
|
2020-11-22 01:03:24 +08:00
|
|
|
$docs = ApiDocsGenerator::generateConsideringCache();
|
|
|
|
$this->setPageTitle(trans('settings.users_api_tokens_docs'));
|
2021-06-26 23:23:15 +08:00
|
|
|
|
2020-01-16 04:18:02 +08:00
|
|
|
return view('api-docs.index', [
|
|
|
|
'docs' => $docs,
|
|
|
|
]);
|
2020-01-13 00:25:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show a JSON view of the API docs data.
|
|
|
|
*/
|
2020-11-22 01:03:24 +08:00
|
|
|
public function json()
|
2020-01-13 00:25:14 +08:00
|
|
|
{
|
2020-11-22 01:03:24 +08:00
|
|
|
$docs = ApiDocsGenerator::generateConsideringCache();
|
2021-06-26 23:23:15 +08:00
|
|
|
|
2020-11-22 01:03:24 +08:00
|
|
|
return response()->json($docs);
|
2020-01-13 00:25:14 +08:00
|
|
|
}
|
2023-05-29 21:41:59 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Redirect to the API docs page.
|
2023-10-19 00:53:58 +08:00
|
|
|
* Required as a controller method, instead of the Route::redirect helper,
|
|
|
|
* to ensure the URL is generated correctly.
|
2023-05-29 21:41:59 +08:00
|
|
|
*/
|
|
|
|
public function redirect()
|
|
|
|
{
|
|
|
|
return redirect('/api/docs');
|
|
|
|
}
|
2020-01-13 00:25:14 +08:00
|
|
|
}
|