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
99 lines
2.3 KiB
Plaintext
99 lines
2.3 KiB
Plaintext
meta {
|
|
name: Set Library Visibility
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
post {
|
|
url: {{base_url}}/api/libraries/visibility
|
|
auth: inherit
|
|
body: json
|
|
}
|
|
|
|
headers {
|
|
Content-Type: application/json
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"library_id": "{{library_id}}",
|
|
"is_visible": {{is_visible}}
|
|
}
|
|
}
|
|
|
|
tests {
|
|
test_set_visibility_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 in response
|
|
if (!data.library_id) {
|
|
throw new Error("Response missing required field: library_id");
|
|
}
|
|
|
|
if (typeof data.is_visible !== "boolean") {
|
|
throw new Error("Response missing required field: is_visible or not boolean");
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
vars:pre-request {
|
|
libraryId: "8821b703-h29b-71d4-d716-446655440003",
|
|
isVisible: true
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
timeout: 0
|
|
}
|
|
|
|
docs {
|
|
## Set Library Visibility
|
|
|
|
Updates the visibility status of a library for regular users.
|
|
|
|
**Method:** POST
|
|
|
|
**Endpoint:** /api/libraries/visibility
|
|
|
|
**Authentication:** Required (Bearer token, admin permissions)
|
|
|
|
**Request Body:**
|
|
- `library_id` (string, required): Library UUID
|
|
- `is_visible` (boolean, required): Visibility status
|
|
- `true`: Library visible to all users
|
|
- `false`: Library hidden from regular users
|
|
|
|
**Response:** Updated library visibility object
|
|
- `library_id` (string): Library UUID
|
|
- `is_visible` (boolean): Updated visibility status
|
|
- `updated_at` (string): Update timestamp
|
|
|
|
**Status Codes:**
|
|
- 200: Visibility updated successfully
|
|
- 400: Invalid request data
|
|
- 401: Unauthorized
|
|
- 403: Forbidden (admin access required)
|
|
- 404: Library not found
|
|
- 500: Internal server error
|
|
} |