Standardize all Bruno environment variables to use snake_case convention
(aligned with Go naming practices) and remove duplicate camelCase variants.
Changes:
- Environment file cleanup:
- Remove: baseUrl, ebookid, fakebookid, libraryId, mediaItemId, isVisible, refreshToken
- Standardize: fakebookid → fake_book_id, isVisible → is_visible, refreshToken → refresh_token
- All variables now use consistent snake_case format
- Update all Bruno requests to use standardized variables:
- ebooks: {{ebookid}} → {{ebook_id}}
- library: {{libraryId}} → {{library_id}}
- media-items: {{mediaItemId}} → {{media_item_id}}
- visibility: {{isVisible}} → {{is_visible}}
- auth: {{refreshToken}} → {{refresh_token}}
Benefits:
- Single source of truth for each variable
- Consistent with Go naming conventions
- No ambiguity about which variable name to use
- Cleaner, more maintainable codebase
114 lines
2.7 KiB
Plaintext
114 lines
2.7 KiB
Plaintext
meta {
|
|
name: Add Library Folder
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
post {
|
|
url: {{base_url}}/api/libraries/{{library_id}}/folders
|
|
auth: inherit
|
|
body: json
|
|
}
|
|
|
|
headers {
|
|
Content-Type: application/json
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"folder_path": "/path/to/library/media"
|
|
}
|
|
}
|
|
|
|
tests {
|
|
test_add_library_folder_success(status, headers, body) {
|
|
if (status !== 201) {
|
|
throw new Error("Expected status 201, 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);
|
|
}
|
|
|
|
// Verify response body is valid JSON and has expected structure
|
|
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 response body to be an object");
|
|
}
|
|
|
|
// Check for required fields in folder response
|
|
if (!data.id) {
|
|
throw new Error("Folder response missing required field: id");
|
|
}
|
|
|
|
if (!data.library_id) {
|
|
throw new Error("Folder response missing required field: library_id");
|
|
}
|
|
|
|
if (!data.folder_path) {
|
|
throw new Error("Folder response missing required field: folder_path");
|
|
}
|
|
|
|
// Validate data types
|
|
if (typeof data.id !== "string") {
|
|
throw new Error("Folder id must be a string");
|
|
}
|
|
|
|
if (typeof data.folder_path !== "string") {
|
|
throw new Error("Folder path must be a string");
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
vars:pre-request {
|
|
libraryId: "8821b703-h29b-71d4-d716-446655440003"
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
timeout: 0
|
|
}
|
|
|
|
docs {
|
|
## Add Library Folder
|
|
|
|
Adds a new folder path to a library for media scanning and indexing.
|
|
|
|
**Method:** POST
|
|
|
|
**Endpoint:** /api/libraries/{id}/folders
|
|
|
|
**Authentication:** Required (Bearer token, admin permissions)
|
|
|
|
**Path Parameters:**
|
|
- `id` (string, required): Library UUID
|
|
|
|
**Request Body:**
|
|
- `folder_path` (string, required): Absolute path to the folder containing media files
|
|
|
|
**Response:** Folder object
|
|
- `id` (string): Folder UUID
|
|
- `library_id` (string): Library UUID
|
|
- `folder_path` (string): Absolute path to folder
|
|
- `is_active` (boolean): Whether folder is active for scanning
|
|
- `created_at` (string): Creation timestamp
|
|
- `updated_at` (string): Last update timestamp
|
|
|
|
**Status Codes:**
|
|
- 201: Folder added successfully
|
|
- 400: Invalid folder path or request data
|
|
- 401: Unauthorized
|
|
- 403: Forbidden (admin access required)
|
|
- 404: Library not found
|
|
- 409: Folder already exists for this library
|
|
- 500: Internal server error
|
|
} |