- 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
80 lines
2.0 KiB
Plaintext
80 lines
2.0 KiB
Plaintext
meta {
|
|
name: Get Scan Settings
|
|
type: http
|
|
seq: 2
|
|
}
|
|
|
|
get {
|
|
url: {{base_url}}/api/library/scan-settings
|
|
auth: inherit
|
|
}
|
|
|
|
headers {
|
|
Content-Type: application/json
|
|
}
|
|
|
|
tests {
|
|
test_get_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 required fields
|
|
if (typeof data.scan_frequency_minutes !== "number" || data.scan_frequency_minutes < 1) {
|
|
throw new Error("Invalid scan_frequency_minutes: " + data.scan_frequency_minutes);
|
|
}
|
|
|
|
if (typeof data.auto_scan_enabled !== "boolean") {
|
|
throw new Error("Invalid auto_scan_enabled: " + data.auto_scan_enabled);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
timeout: 0
|
|
}
|
|
|
|
docs {
|
|
## Get Scan Settings
|
|
|
|
Retrieves the user's current library scanning settings.
|
|
|
|
**Method:** GET
|
|
|
|
**Endpoint:** /api/library/scan-settings
|
|
|
|
**Authentication:** Required (Bearer token)
|
|
|
|
**Response:**
|
|
- `scan_frequency_minutes` (number): Minutes between automatic scans (minimum 1)
|
|
- `auto_scan_enabled` (boolean): Whether automatic scanning is enabled
|
|
- `last_scan_at` (string, optional): Timestamp of last scan
|
|
- `next_scan_at` (string, optional): Timestamp of next scheduled scan
|
|
- `library_id` (string, optional): Library ID for context
|
|
|
|
**Status Codes:**
|
|
- 200: Success
|
|
- 401: Unauthorized
|
|
- 403: Forbidden (access denied)
|
|
- 500: Internal server error
|
|
} |