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
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user