test(bruno): update API tests for /api/media-items/ endpoints
- Update bulk-delete test: endpoint URL, request field (book_ids → media_item_ids), response field (success → deleted), documentation - Update bulk-update test: endpoint URL, request structure (updates → media_item_updates), response field (success → updated), documentation - Update download test: endpoint URL (/api/books/ → /api/media-items/), documentation
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
meta {
|
meta {
|
||||||
name: Bulk Delete Books
|
name: Bulk Delete Media Items
|
||||||
type: http
|
type: http
|
||||||
seq: 1
|
seq: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
url: {{base_url}}/api/books/bulk-delete
|
url: {{base_url}}/api/media-items/bulk-delete
|
||||||
body: json
|
body: json
|
||||||
auth: inherit
|
auth: inherit
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ headers {
|
|||||||
|
|
||||||
body:json {
|
body:json {
|
||||||
{
|
{
|
||||||
"book_ids": [
|
"media_item_ids": [
|
||||||
"{{bookId1}}",
|
"{{bookId1}}",
|
||||||
"{{bookId2}}",
|
"{{bookId2}}",
|
||||||
"{{bookId3}}"
|
"{{bookId3}}"
|
||||||
@@ -31,7 +31,7 @@ script:post-response {
|
|||||||
const body = res.getBody();
|
const body = res.getBody();
|
||||||
tests['Has results array'] = Array.isArray(body.results);
|
tests['Has results array'] = Array.isArray(body.results);
|
||||||
tests['Has total count'] = body.total !== undefined;
|
tests['Has total count'] = body.total !== undefined;
|
||||||
tests['Has success count'] = body.success !== undefined;
|
tests['Has deleted count'] = body.deleted !== undefined;
|
||||||
tests['Has failed count'] = body.failed !== undefined;
|
tests['Has failed count'] = body.failed !== undefined;
|
||||||
} else {
|
} else {
|
||||||
tests['Bulk delete failed'] = false;
|
tests['Bulk delete failed'] = false;
|
||||||
@@ -46,23 +46,23 @@ settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
docs {
|
docs {
|
||||||
## Bulk Delete Books
|
## Bulk Delete Media Items
|
||||||
|
|
||||||
Deletes multiple books in a single request.
|
Deletes multiple media items in a single request.
|
||||||
|
|
||||||
**Method:** POST
|
**Method:** POST
|
||||||
|
|
||||||
**Endpoint:** /api/books/bulk-delete
|
**Endpoint:** /api/media-items/bulk-delete
|
||||||
|
|
||||||
**Authentication:** Required (Bearer token)
|
**Authentication:** Required (Bearer token)
|
||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
- `book_ids` (array of strings): Array of book UUIDs to delete
|
- `media_item_ids` (array of strings): Array of media item UUIDs to delete
|
||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
- `results` (array): Results for each deletion attempt
|
- `results` (array): Results for each deletion attempt
|
||||||
- `total` (number): Total number of books processed
|
- `total` (number): Total number of media items processed
|
||||||
- `success` (number): Number of successfully deleted books
|
- `deleted` (number): Number of successfully deleted media items
|
||||||
- `failed` (number): Number of failed deletions
|
- `failed` (number): Number of failed deletions
|
||||||
|
|
||||||
**Status Codes:**
|
**Status Codes:**
|
||||||
@@ -75,7 +75,7 @@ docs {
|
|||||||
**Example:**
|
**Example:**
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"book_ids": [
|
"media_item_ids": [
|
||||||
"uuid-1",
|
"uuid-1",
|
||||||
"uuid-2",
|
"uuid-2",
|
||||||
"uuid-3"
|
"uuid-3"
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
meta {
|
meta {
|
||||||
name: Bulk Update Books
|
name: Bulk Update Media Items
|
||||||
type: http
|
type: http
|
||||||
seq: 2
|
seq: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
url: {{base_url}}/api/books/bulk-update
|
url: {{base_url}}/api/media-items/bulk-update
|
||||||
body: json
|
body: json
|
||||||
auth: inherit
|
auth: inherit
|
||||||
}
|
}
|
||||||
@@ -16,9 +16,9 @@ headers {
|
|||||||
|
|
||||||
body:json {
|
body:json {
|
||||||
{
|
{
|
||||||
"updates": [
|
"media_item_updates": [
|
||||||
{
|
{
|
||||||
"book_id": "{{bookId1}}",
|
"media_item_id": "{{bookId1}}",
|
||||||
"updates": {
|
"updates": {
|
||||||
"title": "Updated Title",
|
"title": "Updated Title",
|
||||||
"genre": "Science Fiction",
|
"genre": "Science Fiction",
|
||||||
@@ -26,7 +26,7 @@ body:json {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"book_id": "{{bookId2}}",
|
"media_item_id": "{{bookId2}}",
|
||||||
"updates": {
|
"updates": {
|
||||||
"author": "Updated Author",
|
"author": "Updated Author",
|
||||||
"contributors": ["O'Reilly Media", "Penguin Random House"]
|
"contributors": ["O'Reilly Media", "Penguin Random House"]
|
||||||
@@ -43,7 +43,7 @@ script:post-response {
|
|||||||
const body = res.getBody();
|
const body = res.getBody();
|
||||||
tests['Has results array'] = Array.isArray(body.results);
|
tests['Has results array'] = Array.isArray(body.results);
|
||||||
tests['Has total count'] = body.total !== undefined;
|
tests['Has total count'] = body.total !== undefined;
|
||||||
tests['Has success count'] = body.success !== undefined;
|
tests['Has updated count'] = body.updated !== undefined;
|
||||||
} else {
|
} else {
|
||||||
tests['Bulk update failed'] = false;
|
tests['Bulk update failed'] = false;
|
||||||
}
|
}
|
||||||
@@ -57,25 +57,25 @@ settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
docs {
|
docs {
|
||||||
## Bulk Update Books
|
## Bulk Update Media Items
|
||||||
|
|
||||||
Updates multiple books in a single request with different fields for each book.
|
Updates multiple media items in a single request with different fields for each item.
|
||||||
|
|
||||||
**Method:** POST
|
**Method:** POST
|
||||||
|
|
||||||
**Endpoint:** /api/books/bulk-update
|
**Endpoint:** /api/media-items/bulk-update
|
||||||
|
|
||||||
**Authentication:** Required (Bearer token)
|
**Authentication:** Required (Bearer token)
|
||||||
|
|
||||||
**Request Body:**
|
**Request Body:**
|
||||||
- `updates` (array): Array of update objects
|
- `media_item_updates` (array): Array of update objects
|
||||||
- `book_id` (string): Book UUID to update
|
- `media_item_id` (string): Media item UUID to update
|
||||||
- `updates` (object): Fields to update (can include title, author, genre, tags, contributors, etc.)
|
- `updates` (object): Fields to update (can include title, author, genre, tags, contributors, etc.)
|
||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
- `results` (array): Results for each update attempt
|
- `results` (array): Results for each update attempt
|
||||||
- `total` (number): Total number of books processed
|
- `total` (number): Total number of media items processed
|
||||||
- `success` (number): Number of successfully updated books
|
- `updated` (number): Number of successfully updated media items
|
||||||
- `failed` (number): Number of failed updates
|
- `failed` (number): Number of failed updates
|
||||||
|
|
||||||
**Status Codes:**
|
**Status Codes:**
|
||||||
@@ -88,9 +88,9 @@ docs {
|
|||||||
**Example:**
|
**Example:**
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"updates": [
|
"media_item_updates": [
|
||||||
{
|
{
|
||||||
"book_id": "uuid-1",
|
"media_item_id": "uuid-1",
|
||||||
"updates": {
|
"updates": {
|
||||||
"title": "New Title",
|
"title": "New Title",
|
||||||
"genre": "Fiction",
|
"genre": "Fiction",
|
||||||
@@ -98,7 +98,7 @@ docs {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"book_id": "uuid-2",
|
"media_item_id": "uuid-2",
|
||||||
"updates": {
|
"updates": {
|
||||||
"author": "Jane Doe",
|
"author": "Jane Doe",
|
||||||
"contributors": ["Publisher Inc."]
|
"contributors": ["Publisher Inc."]
|
||||||
@@ -108,5 +108,5 @@ docs {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** Each book can have different fields updated. Only the specified fields are modified for each book.
|
**Note:** Each media item can have different fields updated. Only the specified fields are modified for each item.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
meta {
|
meta {
|
||||||
name: Download EPUB Book
|
name: Download Media Item
|
||||||
type: http
|
type: http
|
||||||
seq: 1
|
seq: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
get {
|
get {
|
||||||
url: {{baseURL}}/api/books/{{bookUUID}}/download
|
url: {{baseURL}}/api/media-items/{{bookUUID}}/download
|
||||||
body: none
|
body: none
|
||||||
auth: none
|
auth: none
|
||||||
}
|
}
|
||||||
@@ -16,27 +16,27 @@ settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
docs {
|
docs {
|
||||||
## Download EPUB Book
|
## Download Media Item
|
||||||
|
|
||||||
Download an EPUB book file from Bookhoard server. No authentication required for Kobo device downloads.
|
Download a media item file (EPUB, PDF, etc.) from Bookhoard server.
|
||||||
|
|
||||||
**Method:** GET
|
**Method:** GET
|
||||||
|
|
||||||
**Endpoint:** /api/books/{bookUUID}/download
|
**Endpoint:** /api/media-items/{bookUUID}/download
|
||||||
|
|
||||||
**Authentication:** None (for Kobo device downloads)
|
**Authentication:** None (for Kobo device downloads)
|
||||||
|
|
||||||
**Path Parameters:**
|
**Path Parameters:**
|
||||||
- `bookUUID` (string): Book UUID
|
- `bookUUID` (string): Media item UUID
|
||||||
|
|
||||||
**Response:** Binary EPUB file data
|
**Response:** Binary file data (EPUB, PDF, etc.)
|
||||||
|
|
||||||
**Response Headers:**
|
**Response Headers:**
|
||||||
- `Content-Type`: application/epub+zip
|
- `Content-Type`: application/epub+zip, application/pdf, or appropriate MIME type
|
||||||
|
|
||||||
**Status Codes:**
|
**Status Codes:**
|
||||||
- 200: Success - EPUB file returned
|
- 200: Success - File returned
|
||||||
- 404: Book not found
|
- 404: Media item not found
|
||||||
|
|
||||||
**Note:** This endpoint is designed for Kobo devices to download books directly from Bookhoard. The endpoint returns the book file with appropriate Content-Type headers.
|
**Note:** This endpoint is designed for Kobo devices to download media items directly from Bookhoard. The endpoint returns the file with appropriate Content-Type headers.
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user