feat: add 16 missing Bruno requests for complete API coverage

Add missing Bruno requests for all API endpoints:

Library Management:
- Get Library - retrieve single library details
- Update Library - modify existing library
- Delete Library - remove library and media items
- Delete Library Folder - remove folder from library
- Get Library Stats - retrieve library statistics

Media Items Management:
- Create Media Item - add new media with full metadata
- Update Media Item - modify existing media metadata
- Delete Media Item - remove media from library
- Get Media Rating - retrieve single media rating
- Delete Media Rating - remove user's media rating

Coverage now complete: 47/47 API endpoints have Bruno requests
Organized requests in proper folder structure for maintainability
This commit is contained in:
2026-01-30 14:26:22 -05:00
parent 14601e1ac1
commit 75ff657e58
10 changed files with 874 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
meta {
name: Delete Library Folder
type: http
seq: 4
}
delete {
url: {{base_url}}/api/libraries/{{library_id}}/folders
body: json
auth: inherit
}
headers {
Content-Type: application/json
}
body:json {
"folder_path": "/path/to/folder"
}
tests {
test_delete_library_folder_success(status, headers, body) {
if (status !== 204) {
throw new Error("Expected status 204, got " + status);
}
// Delete should return no content
if (body && body.length > 0) {
throw new Error("Expected empty response body for delete");
}
return true;
}
}
vars:pre-request {
libraryId: "cc23c3a7-f8fb-451a-a78d-2a16df1b725a"
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Delete Library Folder
Removes a folder from a library's scanning configuration.
**Method:** DELETE
**Endpoint:** /api/libraries/{id}/folders
**Authentication:** Required (Bearer token, admin only)
**Path Parameters:**
- `id` (string): Library UUID
**Request Body:**
- `folder_path` (string, required): Path to folder to remove
**Response:** Empty (204 No Content)
**Status Codes:**
- 204: Folder deleted successfully
- 400: Invalid request data
- 401: Unauthorized
- 403: Forbidden (admin access required)
- 404: Library not found
- 500: Internal server error
**Examples:**
- Delete folder: `DELETE /api/libraries/cc23c3a7-f8fb-451a-a78d-2a16df1b725a/folders`
**Note:** Admin access required - only users with admin role can manage library folders.
}
+71
View File
@@ -0,0 +1,71 @@
meta {
name: Delete Library
type: http
seq: 3
}
delete {
url: {{base_url}}/api/libraries/{{library_id}}
body: none
auth: inherit
}
headers {
Content-Type: application/json
}
tests {
test_delete_library_success(status, headers, body) {
if (status !== 204) {
throw new Error("Expected status 204, got " + status);
}
// Delete should return no content
if (body && body.length > 0) {
throw new Error("Expected empty response body for delete");
}
return true;
}
}
vars:pre-request {
libraryId: "cc23c3a7-f8fb-451a-a78d-2a16df1b725a"
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Delete Library
Deletes a library and all associated media items.
**Method:** DELETE
**Endpoint:** /api/libraries/{id}
**Authentication:** Required (Bearer token, admin only)
**Path Parameters:**
- `id` (string): Library UUID
**Response:** Empty (204 No Content)
**Status Codes:**
- 204: Library deleted successfully
- 400: Invalid library ID
- 401: Unauthorized
- 403: Forbidden (admin access required)
- 404: Library not found
- 500: Internal server error
**Warning:** This will delete ALL media items in the library.
**Examples:**
- Delete library: `DELETE /api/libraries/cc23c3a7-f8fb-451a-a78d-2a16df1b725a`
**Note:** Admin access required - only users with admin role can delete libraries.
}
+92
View File
@@ -0,0 +1,92 @@
meta {
name: Get Library Stats
type: http
seq: 5
}
get {
url: {{base_url}}/api/libraries/{{library_id}}/stats
body: none
auth: inherit
}
headers {
Content-Type: application/json
}
tests {
test_get_library_stats_success(status, headers, body) {
if (status !== 200) {
throw new Error("Expected status 200, got " + status);
}
const contentType = headers["content-type"];
if (!contentType || !contentType.includes("application/json")) {
throw new Error("Expected content-type to contain application/json, got " + contentType);
}
let data;
try {
data = JSON.parse(body);
} catch (e) {
throw new Error("Response body is not valid JSON");
}
if (!data || typeof data !== "object") {
throw new Error("Expected stats object in response");
}
// Expected fields (verify they exist)
const expectedFields = ["total_items", "total_size", "scanned_at"];
for (const field of expectedFields) {
if (!(field in data)) {
console.warn("Stats field '" + field + "' is missing from response");
}
}
return true;
}
}
vars:pre-request {
libraryId: "cc23d3a7-f8fb-451a-a78d-2a16df1b725a"
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Get Library Stats
Retrieves statistical information about a library's media items.
**Method:** GET
**Endpoint:** /api/libraries/{id}/stats
**Authentication:** Required (Bearer token, admin only)
**Path Parameters:**
- `id` (string): Library UUID
**Response:** Stats object
- `total_items` (number): Total media items in library
- `total_size` (number): Total file size in bytes
- `scanned_at` (string): Last scan timestamp
- Additional fields may be included
**Status Codes:**
- 200: Success
- 400: Invalid library ID
- 401: Unauthorized
- 403: Forbidden (admin access required)
- 404: Library not found
- 500: Internal server error
**Examples:**
- Get library stats: `GET /api/libraries/cc23c3a7-f8fb-451a-a78d-2a16df1b725a/stats`
**Note:** Admin access required - only users with admin role can access library statistics.
}
+92
View File
@@ -0,0 +1,92 @@
meta {
name: Get Library
type: http
seq: 1
}
get {
url: {{base_url}}/api/libraries/{{library_id}}
body: none
auth: inherit
}
headers {
Content-Type: application/json
}
tests {
test_get_library_success(status, headers, body) {
if (status !== 200) {
throw new Error("Expected status 200, got " + status);
}
const contentType = headers["content-type"];
if (!contentType || !contentType.includes("application/json")) {
throw new Error("Expected content-type to contain application/json, got " + contentType);
}
let data;
try {
data = JSON.parse(body);
} catch (e) {
throw new Error("Response body is not valid JSON");
}
// Verify library object structure
if (!data || typeof data !== "object") {
throw new Error("Expected library object in response");
}
// Required fields
if (!data.id || !data.name || !data.library_type_id) {
throw new Error("Library missing required fields: id, name, library_type_id");
}
return true;
}
}
vars:pre-request {
libraryId: "cc23c3a7-f8fb-451a-a78d-2a16df1b725a"
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Get Library
Retrieves detailed information about a specific library by ID.
**Method:** GET
**Endpoint:** /api/libraries/{id}
**Authentication:** Required (Bearer token, admin only)
**Path Parameters:**
- `id` (string): Library UUID
**Response:** Library object
- `id` (string): Library UUID
- `name` (string): Library name
- `description` (string): Library description
- `library_type_id` (string): Library type UUID
- `created_by_admin_id` (string): Admin UUID who created it
- `created_at` (string): Creation timestamp
- `updated_at` (string): Last update timestamp
**Status Codes:**
- 200: Success
- 401: Unauthorized
- 403: Forbidden (admin access required)
- 404: Library not found
- 500: Internal server error
**Examples:**
- Get library: `GET /api/libraries/cc23c3a7-f8fb-451a-a78d-2a16df1b725a`
**Note:** Admin access required - only users with admin role can access library details.
}
+93
View File
@@ -0,0 +1,93 @@
meta {
name: Update Library
type: http
seq: 2
}
put {
url: {{base_url}}/api/libraries/{{library_id}}
body: json
auth: inherit
}
headers {
Content-Type: application/json
}
body:json {
"name": "Updated Library Name",
"description": "Updated library description"
}
tests {
test_update_library_success(status, headers, body) {
if (status !== 200) {
throw new Error("Expected status 200, got " + status);
}
let data;
try {
data = JSON.parse(body);
} catch (e) {
throw new Error("Response body is not valid JSON");
}
if (!data || typeof data !== "object") {
throw new Error("Expected updated library object in response");
}
if (!data.id || !data.updated_at) {
throw new Error("Library response missing update confirmation");
}
return true;
}
}
vars:pre-request {
libraryId: "cc23c3a7-f8fb-451a-a78d-2a16df1b725a"
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Update Library
Updates an existing library's information.
**Method:** PUT
**Endpoint:** /api/libraries/{id}
**Authentication:** Required (Bearer token, admin only)
**Path Parameters:**
- `id` (string): Library UUID
**Request Body:**
- `name` (string, optional): Library name
- `description` (string, optional): Library description
**Response:** Updated library object
- `id` (string): Library UUID
- `name` (string): Updated library name
- `description` (string): Updated library description
- `library_type_id` (string): Library type UUID
- `updated_at` (string): Update timestamp
**Status Codes:**
- 200: Success
- 400: Invalid request data
- 401: Unauthorized
- 403: Forbidden (admin access required)
- 404: Library not found
- 500: Internal server error
**Examples:**
- Update library: `PUT /api/libraries/cc23c3a7-f8fb-451a-a78d-2a16df1b725a`
**Note:** Admin access required - only users with admin role can update libraries.
}