2021-06-26 11:23:15 -04:00
|
|
|
<?php
|
|
|
|
|
2023-05-17 12:56:55 -04:00
|
|
|
namespace BookStack\Api;
|
2020-01-12 11:25:14 -05:00
|
|
|
|
2023-05-18 15:53:39 -04:00
|
|
|
use BookStack\Http\ApiController;
|
2020-01-12 11:25:14 -05:00
|
|
|
|
|
|
|
class ApiDocsController extends ApiController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Load the docs page for the API.
|
|
|
|
*/
|
|
|
|
public function display()
|
|
|
|
{
|
2020-11-21 12:03:24 -05:00
|
|
|
$docs = ApiDocsGenerator::generateConsideringCache();
|
|
|
|
$this->setPageTitle(trans('settings.users_api_tokens_docs'));
|
2021-06-26 11:23:15 -04:00
|
|
|
|
2020-01-15 15:18:02 -05:00
|
|
|
return view('api-docs.index', [
|
|
|
|
'docs' => $docs,
|
|
|
|
]);
|
2020-01-12 11:25:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show a JSON view of the API docs data.
|
|
|
|
*/
|
2020-11-21 12:03:24 -05:00
|
|
|
public function json()
|
2020-01-12 11:25:14 -05:00
|
|
|
{
|
2020-11-21 12:03:24 -05:00
|
|
|
$docs = ApiDocsGenerator::generateConsideringCache();
|
2021-06-26 11:23:15 -04:00
|
|
|
|
2020-11-21 12:03:24 -05:00
|
|
|
return response()->json($docs);
|
2020-01-12 11:25:14 -05:00
|
|
|
}
|
2023-05-29 09:41:59 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Redirect to the API docs page.
|
|
|
|
*/
|
|
|
|
public function redirect()
|
|
|
|
{
|
|
|
|
return redirect('/api/docs');
|
|
|
|
}
|
2020-01-12 11:25:14 -05:00
|
|
|
}
|