Files
bookhoard/bruno/library/Get Libraries (Admin).yml
john-okeefe 58a30b6561 chore(bruno): add multi-library dev setup with scan-all and folder requests
Update NewDevDBSetup collection to create Ebook, Comic, and Manga
libraries with separate IDs (ebook_library_id, comic_library_id,
manga_library_id) instead of a single library_id.

- Fix CreateComicLibrary and CreateMangaLibrary to use correct
  names, descriptions, and types instead of duplicating Ebook values
- Update NewDB.sh to run the full setup sequence: register user,
  create all three libraries, add folders, then scan all
- Add AddEbookLibraryFolder, AddComicLibraryFolder, and
  AddMangaLibraryFolder requests with per-type subfolder paths
- Add ScanAllLibraries request using bru.sendRequest() to scan
  each library sequentially via the /api/scanner/scan endpoint
- Update Get Libraries (Admin) to save all three library IDs
- Update List Media Items requests to use ebook_library_id
- Rename library_id to ebook_library_id in Create Library and
  Add Library Folder requests
- Add comic_library_id and manga_library_id to environment
2026-04-19 18:08:39 -04:00

96 lines
2.8 KiB
YAML

info:
name: Get Libraries (Admin)
type: http
seq: 3
http:
method: GET
url: "{{base_url}}/api/libraries"
headers:
- name: ""
value: application/json
auth: inherit
runtime:
scripts:
- type: after-response
code: |-
function onResponse(res) {
try {
const responseBody = res.getBody();
let ebook_id
let comic_id
let manga_id
if (res.status === 200) {
for (var lib of responseBody.data) {
if (lib.name.includes("Ebook")) ebook_id = lib.id
if (lib.name.includes("Comic")) comic_id = lib.id
if (lib.name.includes("Manga")) manga_id = lib.id
}
}
if (ebook_id && ebook_id !== "") {
bru.setEnvVar("ebook_library_id", ebook_id, { persist: true });
console.log("Ebook Library ID saved:", ebook_id);
}
if (comic_id && comic_id !== "") {
bru.setEnvVar("comic_library_id", comic_id, { persist: true });
console.log("Comic Library ID saved:", comic_id);
}
if (manga_id && manga_id !== "") {
bru.setEnvVar("manga_library_id", manga_id, { persist: true });
console.log("Manga Library ID saved:", manga_id);
}
if (!ebook_id || ebook_id === "") {
console.log("No Ebook id found in response.");
}
if (!comic_id || comic_id === "") {
console.log("No Comic id found in response.");
}
if (!manga_id || manga_id === "") {
console.log("No Manga id found in response.");
}
} catch (error) {
console.error("Error in post-response script:", error.message);
}
}
onResponse(res);
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Get Libraries (Admin)
Retrieves all libraries in the system (admin access required).
**Method:** GET
**Endpoint:** /api/libraries
**Authentication:** Required (Bearer token, admin permissions)
**Response:** Array of library objects
- `id` (string): Library UUID
- `name` (string): Library name
- `description` (string, optional): Library description
- `type` (string): Library type (ebooks, audiobooks, videos, other)
- `is_visible` (boolean): Library visibility to users
- `media_count` (number): Number of media items in library
- `folder_count` (number): Number of folders associated
- `created_at` (string): Creation timestamp
- `updated_at` (string): Last update timestamp
**Status Codes:**
- 200: Success
- 401: Unauthorized
- 403: Forbidden (admin access required)
- 500: Internal server error