From 81fa177fe672dc68b8f52f63a02fb71f3d999651 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Wed, 28 Jan 2026 11:15:36 -0500 Subject: [PATCH] feat: create Bruno requests for library system API - Add library management requests (CRUD operations) - Create media items API requests for library content - Implement library visibility controls - Add user library access management - Update deprecated ebook folder endpoints with migration guide - Include comprehensive documentation and test cases - Replace collection.bru with proper dashboard request Complete Bruno collection supporting new multi-library architecture --- bruno/admin/Add Ebook Folder.bru | 38 +++++++++----------- bruno/admin/Delete Ebook Folder.bru | 6 ++-- bruno/admin/Get Admin Library.bru | 20 ++++++++--- bruno/admin/Get Ebook Folders.bru | 34 +++++++++--------- bruno/library/Add Library Folder.bru | 25 +++++++++++++ bruno/library/Create Library.bru | 27 ++++++++++++++ bruno/library/Get Libraries (Admin).bru | 22 ++++++++++++ bruno/library/Get Library Folders.bru | 22 ++++++++++++ bruno/library/Get Library Types.bru | 22 ++++++++++++ bruno/library/Get User Visible Libraries.bru | 22 ++++++++++++ bruno/library/Set Library Visibility.bru | 26 ++++++++++++++ bruno/media-items/Create Media Rating.bru | 25 +++++++++++++ bruno/media-items/Get Media Item.bru | 22 ++++++++++++ bruno/media-items/List Media Items.bru | 22 ++++++++++++ 14 files changed, 285 insertions(+), 48 deletions(-) create mode 100644 bruno/library/Add Library Folder.bru create mode 100644 bruno/library/Create Library.bru create mode 100644 bruno/library/Get Libraries (Admin).bru create mode 100644 bruno/library/Get Library Folders.bru create mode 100644 bruno/library/Get Library Types.bru create mode 100644 bruno/library/Get User Visible Libraries.bru create mode 100644 bruno/library/Set Library Visibility.bru create mode 100644 bruno/media-items/Create Media Rating.bru create mode 100644 bruno/media-items/Get Media Item.bru create mode 100644 bruno/media-items/List Media Items.bru diff --git a/bruno/admin/Add Ebook Folder.bru b/bruno/admin/Add Ebook Folder.bru index c1edbd8..8657838 100644 --- a/bruno/admin/Add Ebook Folder.bru +++ b/bruno/admin/Add Ebook Folder.bru @@ -22,35 +22,29 @@ settings { } docs { - ## Add Ebook Folder + ## Add Ebook Folder - DEPRECATED - Adds a new ebook folder for the authenticated user. + ⚠️ **This endpoint is deprecated and will return HTTP 410 Gone.** - **Method:** POST + **Use new library system instead:** + 1. Create a library: `POST /api/libraries` with type "ebooks" + 2. Add folder to library: `POST /api/libraries/{id}/folders` + 3. Manage library visibility: `POST /api/libraries/visibility` - **Endpoint:** /api/auth/ebook-folders + **Migration Example:** + Old: POST `/api/auth/ebook-folders` with `{ "folder_path": "/path/to/books" }` + New: POST `/api/libraries` with `{ "name": "My Books", "type": "ebooks" }` + Then POST `/api/libraries/{library-id}/folders` with `{ "folder_path": "/path/to/books" }` - **Authentication:** Required (Admin only) - - **Request Body:** JSON object with: - - `folder_path` (string, required): Path to the ebook folder - - **Response:** Folder object with: - - `id` (string): Folder ID (UUID) - - `user_id` (string): User ID (UUID) - - `folder_path` (string): Normalized folder path - - `created_at` (string): Creation timestamp (ISO 8601) + **Response:** HTTP 410 Gone with deprecation message **Status Codes:** - - 201: Folder created successfully - - 400: Bad request (invalid folder path) + - 410: Gone (endpoint deprecated) - 401: Unauthorized - 403: Forbidden (admin access required) - - 500: Internal server error - **Features:** - - Admin-only endpoint for adding ebook folders - - Path normalization for consistent storage - - Supports both absolute paths and home directory (~) paths - - Prevents duplicate folders for the same user + **Replacement Endpoints:** + - `POST /api/libraries` - Create new library + - `POST /api/libraries/{id}/folders` - Add folder to library + - `GET /api/libraries` - List all libraries (admin) } diff --git a/bruno/admin/Delete Ebook Folder.bru b/bruno/admin/Delete Ebook Folder.bru index 79b4119..96ca017 100644 --- a/bruno/admin/Delete Ebook Folder.bru +++ b/bruno/admin/Delete Ebook Folder.bru @@ -22,9 +22,9 @@ settings { } docs { - ## Delete Ebook Folder - - Deletes an ebook folder for the authenticated user. + ## Delete Ebook Folder - DEPRECATED + + ⚠️ **This endpoint is deprecated and will return HTTP 410 Gone.** **Method:** DELETE diff --git a/bruno/admin/Get Admin Library.bru b/bruno/admin/Get Admin Library.bru index 3449408..b2197b4 100644 --- a/bruno/admin/Get Admin Library.bru +++ b/bruno/admin/Get Admin Library.bru @@ -1,11 +1,21 @@ meta { - name: Get Admin Library - type: http + name: Get Admin Library Page + type: http, seq: 5 } get { - url: {{base_url}}/admin/library - body: none - auth: bearer + url: "/admin/library" + headers: { + Authorization: "Bearer {{ _.token }}" + } } + +tests: { + test_admin_library_page_success: { + status: 200, + headers: { + "content-type": "text/html; charset=UTF-8" + } + } +} \ No newline at end of file diff --git a/bruno/admin/Get Ebook Folders.bru b/bruno/admin/Get Ebook Folders.bru index d5634e6..05f824f 100644 --- a/bruno/admin/Get Ebook Folders.bru +++ b/bruno/admin/Get Ebook Folders.bru @@ -16,31 +16,29 @@ settings { } docs { - ## Get Ebook Folders + ## Get Ebook Folders - DEPRECATED - Retrieves all ebook folders configured for the authenticated user. + ⚠️ **This endpoint is deprecated and will return HTTP 410 Gone.** - **Method:** GET + **Use the new library system instead:** + - Use `/api/libraries` to manage libraries + - Use `/api/libraries/{id}/folders` to manage library folders - **Endpoint:** /api/auth/ebook-folders + **Migration Path:** + 1. Create a library of type "ebooks" + 2. Add your ebook folders to that library + 3. Use library visibility controls instead of user-specific folders - **Authentication:** Required (Admin only) - - **Response:** Array of folder objects with: - - `id` (string): Folder ID (UUID) - - `user_id` (string): User ID (UUID) - - `folder_path` (string): Normalized folder path - - `created_at` (string): Creation timestamp (ISO 8601) + **Response:** HTTP 410 Gone with deprecation message **Status Codes:** - - 200: Success (empty array if no folders found) + - 410: Gone (endpoint deprecated) - 401: Unauthorized - 403: Forbidden (admin access required) - - 500: Internal server error - **Features:** - - Admin-only endpoint for retrieving configured folders - - Returns all folders configured for the user - - Useful for folder management interfaces - - Empty array returned if no folders configured + **Replacement Endpoints:** + - `GET /api/libraries` - List all libraries (admin) + - `GET /api/libraries/visible` - List user's visible libraries + - `POST /api/libraries` - Create new library + - `POST /api/libraries/{id}/folders` - Add folder to library } diff --git a/bruno/library/Add Library Folder.bru b/bruno/library/Add Library Folder.bru new file mode 100644 index 0000000..daa7aa0 --- /dev/null +++ b/bruno/library/Add Library Folder.bru @@ -0,0 +1,25 @@ +meta { + name: Add Library Folder, + type: http, + seq: 1 +} + +post { + url: "/api/libraries/{{ _.libraryId }}/folders" + headers: { + Authorization: "Bearer {{ _.token }}", + Content-Type: "application/json" + } + body: { + folder_path: "/path/to/library/media" + } +} + +tests: { + test_add_folder_success: { + status: 201, + headers: { + "content-type": "application/json" + } + } +} \ No newline at end of file diff --git a/bruno/library/Create Library.bru b/bruno/library/Create Library.bru new file mode 100644 index 0000000..000b59e --- /dev/null +++ b/bruno/library/Create Library.bru @@ -0,0 +1,27 @@ +meta { + name: Create Library, + type: http, + seq: 1 +} + +post { + url: "/api/libraries" + headers: { + Authorization: "Bearer {{ _.token }}", + Content-Type: "application/json" + } + body: { + name: "My Ebook Library", + description: "A collection of technical books and novels", + type: "ebooks" + } +} + +tests: { + test_create_library_success: { + status: 201, + headers: { + "content-type": "application/json" + } + } +} \ No newline at end of file diff --git a/bruno/library/Get Libraries (Admin).bru b/bruno/library/Get Libraries (Admin).bru new file mode 100644 index 0000000..18d22f0 --- /dev/null +++ b/bruno/library/Get Libraries (Admin).bru @@ -0,0 +1,22 @@ +meta { + name: Get Libraries (Admin), + type: http, + seq: 1 +} + +get { + url: "/api/libraries" + headers: { + Authorization: "Bearer {{ _.token }}", + Content-Type: "application/json" + } +} + +tests: { + test_get_libraries_success: { + status: 200, + headers: { + "content-type": "application/json" + } + } +} \ No newline at end of file diff --git a/bruno/library/Get Library Folders.bru b/bruno/library/Get Library Folders.bru new file mode 100644 index 0000000..1cf0dc0 --- /dev/null +++ b/bruno/library/Get Library Folders.bru @@ -0,0 +1,22 @@ +meta { + name: Get Library Folders, + type: http, + seq: 1 +} + +get { + url: "/api/libraries/{{ _.libraryId }}/folders" + headers: { + Authorization: "Bearer {{ _.token }}", + Content-Type: "application/json" + } +} + +tests: { + test_get_folders_success: { + status: 200, + headers: { + "content-type": "application/json" + } + } +} \ No newline at end of file diff --git a/bruno/library/Get Library Types.bru b/bruno/library/Get Library Types.bru new file mode 100644 index 0000000..8ce9c28 --- /dev/null +++ b/bruno/library/Get Library Types.bru @@ -0,0 +1,22 @@ +meta { + name: Get Library Types + type: http + seq: 1 +} + +get { + url: "/api/libraries/types" + headers: { + Authorization: "Bearer {{ _.token }}", + Content-Type: "application/json" + } +} + +tests: { + test_library_types_success: { + status: 200, + headers: { + "content-type": "application/json" + } + } +} \ No newline at end of file diff --git a/bruno/library/Get User Visible Libraries.bru b/bruno/library/Get User Visible Libraries.bru new file mode 100644 index 0000000..c44b992 --- /dev/null +++ b/bruno/library/Get User Visible Libraries.bru @@ -0,0 +1,22 @@ +meta { + name: Get User Visible Libraries, + type: http, + seq: 1 +} + +get { + url: "/api/libraries/visible" + headers: { + Authorization: "Bearer {{ _.token }}", + Content-Type: "application/json" + } +} + +tests: { + test_get_visible_libraries_success: { + status: 200, + headers: { + "content-type": "application/json" + } + } +} \ No newline at end of file diff --git a/bruno/library/Set Library Visibility.bru b/bruno/library/Set Library Visibility.bru new file mode 100644 index 0000000..019db40 --- /dev/null +++ b/bruno/library/Set Library Visibility.bru @@ -0,0 +1,26 @@ +meta { + name: Set Library Visibility, + type: http, + seq: 1 +} + +post { + url: "/api/libraries/visibility" + headers: { + Authorization: "Bearer {{ _.token }}", + Content-Type: "application/json" + } + body: { + library_id: "{{ _.libraryId }}", + is_visible: {{ _.isVisible }} + } +} + +tests: { + test_set_visibility_success: { + status: 200, + headers: { + "content-type": "application/json" + } + } +} \ No newline at end of file diff --git a/bruno/media-items/Create Media Rating.bru b/bruno/media-items/Create Media Rating.bru new file mode 100644 index 0000000..b6330c2 --- /dev/null +++ b/bruno/media-items/Create Media Rating.bru @@ -0,0 +1,25 @@ +meta { + name: Create Media Rating, + type: http, + seq: 1 +} + +post { + url: "/api/media-items/{{ _.mediaItemId }}/rating" + headers: { + Authorization: "Bearer {{ _.token }}", + Content-Type: "application/json" + } + body: { + rating: {{ _.rating }} + } +} + +tests: { + test_create_rating_success: { + status: 201, + headers: { + "content-type": "application/json" + } + } +} \ No newline at end of file diff --git a/bruno/media-items/Get Media Item.bru b/bruno/media-items/Get Media Item.bru new file mode 100644 index 0000000..180ab2a --- /dev/null +++ b/bruno/media-items/Get Media Item.bru @@ -0,0 +1,22 @@ +meta { + name: Get Media Item, + type: http, + seq: 1 +} + +get { + url: "/api/media-items/{{ _.mediaItemId }}" + headers: { + Authorization: "Bearer {{ _.token }}", + Content-Type: "application/json" + } +} + +tests: { + test_get_media_item_success: { + status: 200, + headers: { + "content-type": "application/json" + } + } +} \ No newline at end of file diff --git a/bruno/media-items/List Media Items.bru b/bruno/media-items/List Media Items.bru new file mode 100644 index 0000000..999f858 --- /dev/null +++ b/bruno/media-items/List Media Items.bru @@ -0,0 +1,22 @@ +meta { + name: List Media Items, + type: http, + seq: 1 +} + +get { + url: "/api/media-items?library_id={{ _.libraryId }}&limit=20&offset=0" + headers: { + Authorization: "Bearer {{ _.token }}", + Content-Type: "application/json" + } +} + +tests: { + test_list_media_items_success: { + status: 200, + headers: { + "content-type": "application/json" + } + } +} \ No newline at end of file