Files
bookhoard/bruno/library/Update Scan Settings.bru
T
john-okeefe 8db5939892 refactor: standardize Bruno API requests with bruToJsonV2 format
- Convert all JSON tests to JavaScript functions for bruToJsonV2 compatibility
- Update authentication to use 'inherit' instead of manual headers
- Fix hardcoded URLs to use {{base_url}} variables
- Standardize variable syntax from {{ _.var }} to {{var}}
- Add comprehensive API documentation to all requests
- Update environment variables with missing required fields
- Apply consistent structure: meta, http method, headers, tests, vars, settings, docs
- Enhanced validation with proper error handling and field checks
2026-01-28 20:13:56 -05:00

133 lines
3.0 KiB
Plaintext

meta {
name: Update Scan Settings
type: http
seq: 1
}
put {
url: {{base_url}}/api/library/scan-settings
auth: inherit
body: json
}
headers {
Content-Type: application/json
}
body:json {
{
"scan_frequency_minutes": 60,
"auto_scan_enabled": true
}
}
tests {
test_update_scan_settings_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);
}
// 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 success message or updated settings
if (!data.message && typeof data.scan_frequency_minutes !== "number") {
throw new Error("Response missing expected fields");
}
return true;
}
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Update Scan Settings
Updates user's library scanning settings.
**Method:** PUT
**Endpoint:** /api/library/scan-settings
**Authentication:** Required (Bearer token)
**Request Body:**
- `scan_frequency_minutes` (number, required): Minutes between automatic scans (1-1440)
- `auto_scan_enabled` (boolean, required): Whether automatic scanning is enabled
- `library_id` (string, optional): Specific library ID to update (if not provided, updates global)
**Response:** Updated scan settings object
- `scan_frequency_minutes` (number): Updated frequency
- `auto_scan_enabled` (boolean): Updated enabled status
- `last_scan_at` (string, optional): Timestamp of last scan
- `next_scan_at` (string, optional): Timestamp of next scheduled scan
- `updated_at` (string): Timestamp of settings update
**Status Codes:**
- 200: Success
- 400: Invalid settings (frequency out of range)
- 401: Unauthorized
- 403: Forbidden (access denied)
- 404: Library not found (if library_id provided)
- 500: Internal server error
}
put {
url: {{base_url}}/api/library/scan-settings
body: json
auth: inherit
}
body {
{
"scan_frequency_minutes": 60,
"auto_scan_enabled": true
}
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Update Scan Settings
Updates the user's ebook scanning settings.
**Method:** PUT
**Endpoint:** /api/library/scan-settings
**Authentication:** Required
**Request Body:**
- `scan_frequency_minutes` (integer, required): Minutes between automatic scans (15-1440)
- `auto_scan_enabled` (boolean, required): Whether automatic scanning is enabled
**Response:**
- `message` (string): Success message
**Status Codes:**
- 200: Success
- 400: Invalid settings
- 401: Unauthorized
}