2019-12-28 22:58:07 +08:00
|
|
|
<?php
|
|
|
|
|
2022-09-18 08:25:20 +08:00
|
|
|
/**
|
|
|
|
* Routes for the BookStack API.
|
|
|
|
* Routes have a uri prefix of /api/.
|
2023-05-19 03:53:39 +08:00
|
|
|
* Controllers all end with "ApiController"
|
2022-09-18 08:25:20 +08:00
|
|
|
*/
|
|
|
|
|
2023-05-18 00:56:55 +08:00
|
|
|
use BookStack\Api\ApiDocsController;
|
2023-05-19 03:53:39 +08:00
|
|
|
use BookStack\Entities\Controllers as EntityControllers;
|
2023-05-18 00:56:55 +08:00
|
|
|
use BookStack\Permissions\ContentPermissionApiController;
|
|
|
|
use BookStack\Search\SearchApiController;
|
|
|
|
use BookStack\Uploads\Controllers\AttachmentApiController;
|
|
|
|
use BookStack\Uploads\Controllers\ImageGalleryApiController;
|
|
|
|
use BookStack\Users\Controllers\RoleApiController;
|
|
|
|
use BookStack\Users\Controllers\UserApiController;
|
2021-10-31 04:29:59 +08:00
|
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
|
|
|
|
Route::get('docs.json', [ApiDocsController::class, 'json']);
|
|
|
|
|
|
|
|
Route::get('attachments', [AttachmentApiController::class, 'list']);
|
|
|
|
Route::post('attachments', [AttachmentApiController::class, 'create']);
|
|
|
|
Route::get('attachments/{id}', [AttachmentApiController::class, 'read']);
|
|
|
|
Route::put('attachments/{id}', [AttachmentApiController::class, 'update']);
|
|
|
|
Route::delete('attachments/{id}', [AttachmentApiController::class, 'delete']);
|
|
|
|
|
2023-05-19 03:53:39 +08:00
|
|
|
Route::get('books', [EntityControllers\BookApiController::class, 'list']);
|
|
|
|
Route::post('books', [EntityControllers\BookApiController::class, 'create']);
|
|
|
|
Route::get('books/{id}', [EntityControllers\BookApiController::class, 'read']);
|
|
|
|
Route::put('books/{id}', [EntityControllers\BookApiController::class, 'update']);
|
|
|
|
Route::delete('books/{id}', [EntityControllers\BookApiController::class, 'delete']);
|
|
|
|
|
|
|
|
Route::get('books/{id}/export/html', [EntityControllers\BookExportApiController::class, 'exportHtml']);
|
|
|
|
Route::get('books/{id}/export/pdf', [EntityControllers\BookExportApiController::class, 'exportPdf']);
|
|
|
|
Route::get('books/{id}/export/plaintext', [EntityControllers\BookExportApiController::class, 'exportPlainText']);
|
|
|
|
Route::get('books/{id}/export/markdown', [EntityControllers\BookExportApiController::class, 'exportMarkdown']);
|
|
|
|
|
|
|
|
Route::get('chapters', [EntityControllers\ChapterApiController::class, 'list']);
|
|
|
|
Route::post('chapters', [EntityControllers\ChapterApiController::class, 'create']);
|
|
|
|
Route::get('chapters/{id}', [EntityControllers\ChapterApiController::class, 'read']);
|
|
|
|
Route::put('chapters/{id}', [EntityControllers\ChapterApiController::class, 'update']);
|
|
|
|
Route::delete('chapters/{id}', [EntityControllers\ChapterApiController::class, 'delete']);
|
|
|
|
|
|
|
|
Route::get('chapters/{id}/export/html', [EntityControllers\ChapterExportApiController::class, 'exportHtml']);
|
|
|
|
Route::get('chapters/{id}/export/pdf', [EntityControllers\ChapterExportApiController::class, 'exportPdf']);
|
|
|
|
Route::get('chapters/{id}/export/plaintext', [EntityControllers\ChapterExportApiController::class, 'exportPlainText']);
|
|
|
|
Route::get('chapters/{id}/export/markdown', [EntityControllers\ChapterExportApiController::class, 'exportMarkdown']);
|
|
|
|
|
|
|
|
Route::get('pages', [EntityControllers\PageApiController::class, 'list']);
|
|
|
|
Route::post('pages', [EntityControllers\PageApiController::class, 'create']);
|
|
|
|
Route::get('pages/{id}', [EntityControllers\PageApiController::class, 'read']);
|
|
|
|
Route::put('pages/{id}', [EntityControllers\PageApiController::class, 'update']);
|
|
|
|
Route::delete('pages/{id}', [EntityControllers\PageApiController::class, 'delete']);
|
|
|
|
|
|
|
|
Route::get('pages/{id}/export/html', [EntityControllers\PageExportApiController::class, 'exportHtml']);
|
|
|
|
Route::get('pages/{id}/export/pdf', [EntityControllers\PageExportApiController::class, 'exportPdf']);
|
|
|
|
Route::get('pages/{id}/export/plaintext', [EntityControllers\PageExportApiController::class, 'exportPlainText']);
|
|
|
|
Route::get('pages/{id}/export/markdown', [EntityControllers\PageExportApiController::class, 'exportMarkdown']);
|
2021-10-31 04:29:59 +08:00
|
|
|
|
2023-03-14 20:19:19 +08:00
|
|
|
Route::get('image-gallery', [ImageGalleryApiController::class, 'list']);
|
|
|
|
Route::post('image-gallery', [ImageGalleryApiController::class, 'create']);
|
|
|
|
Route::get('image-gallery/{id}', [ImageGalleryApiController::class, 'read']);
|
|
|
|
Route::put('image-gallery/{id}', [ImageGalleryApiController::class, 'update']);
|
|
|
|
Route::delete('image-gallery/{id}', [ImageGalleryApiController::class, 'delete']);
|
|
|
|
|
2021-11-15 00:28:01 +08:00
|
|
|
Route::get('search', [SearchApiController::class, 'all']);
|
|
|
|
|
2023-05-19 03:53:39 +08:00
|
|
|
Route::get('shelves', [EntityControllers\BookshelfApiController::class, 'list']);
|
|
|
|
Route::post('shelves', [EntityControllers\BookshelfApiController::class, 'create']);
|
|
|
|
Route::get('shelves/{id}', [EntityControllers\BookshelfApiController::class, 'read']);
|
|
|
|
Route::put('shelves/{id}', [EntityControllers\BookshelfApiController::class, 'update']);
|
|
|
|
Route::delete('shelves/{id}', [EntityControllers\BookshelfApiController::class, 'delete']);
|
2021-05-05 19:46:14 +08:00
|
|
|
|
2022-02-03 20:33:26 +08:00
|
|
|
Route::get('users', [UserApiController::class, 'list']);
|
2022-02-04 08:26:19 +08:00
|
|
|
Route::post('users', [UserApiController::class, 'create']);
|
2022-02-03 23:12:50 +08:00
|
|
|
Route::get('users/{id}', [UserApiController::class, 'read']);
|
2022-02-04 00:52:28 +08:00
|
|
|
Route::put('users/{id}', [UserApiController::class, 'update']);
|
2022-02-08 23:29:58 +08:00
|
|
|
Route::delete('users/{id}', [UserApiController::class, 'delete']);
|
2022-04-07 04:57:18 +08:00
|
|
|
|
2023-02-19 02:36:34 +08:00
|
|
|
Route::get('roles', [RoleApiController::class, 'list']);
|
|
|
|
Route::post('roles', [RoleApiController::class, 'create']);
|
|
|
|
Route::get('roles/{id}', [RoleApiController::class, 'read']);
|
|
|
|
Route::put('roles/{id}', [RoleApiController::class, 'update']);
|
|
|
|
Route::delete('roles/{id}', [RoleApiController::class, 'delete']);
|
|
|
|
|
2023-05-19 03:53:39 +08:00
|
|
|
Route::get('recycle-bin', [EntityControllers\RecycleBinApiController::class, 'list']);
|
|
|
|
Route::put('recycle-bin/{deletionId}', [EntityControllers\RecycleBinApiController::class, 'restore']);
|
|
|
|
Route::delete('recycle-bin/{deletionId}', [EntityControllers\RecycleBinApiController::class, 'destroy']);
|
2023-03-13 21:18:33 +08:00
|
|
|
|
2023-03-14 20:19:19 +08:00
|
|
|
Route::get('content-permissions/{contentType}/{contentId}', [ContentPermissionApiController::class, 'read']);
|
|
|
|
Route::put('content-permissions/{contentType}/{contentId}', [ContentPermissionApiController::class, 'update']);
|