refactor(bruno): migrate API tests to Bruno DSL format

- Convert all existing .bru files from JSON to Bruno DSL format
- Remove obsolete files (conflicts/api.bru, kobo/Kobo Initialization.bru)
- Update auth configuration to use 'inherit' instead of explicit bearer tokens
- Add comprehensive documentation to all test files
- Improve test scripts with proper assertions and error handling
This commit is contained in:
2026-02-08 20:49:06 -05:00
parent cb76b9ca05
commit 3117ce54ec
93 changed files with 3974 additions and 1576 deletions
-76
View File
@@ -1,76 +0,0 @@
meta {
name: Bookhoard Kobo Sync
type: collection
environment: Bookhoard
}
### Kobo Initialization Endpoint
GET {{baseURL}}/api/sync/kobo/v1/initialization
Authorization: Bearer {{koboToken}}
x-kobo-device: {"DeviceId":"kobo-clara-test","Model":"Kobo Clara","SerialNumber":"N123456789"}
{
"meta": {
"name": "Kobo Initialization",
"description": "Initialize Kobo sync by returning device resources and account page"
}
}
### Kobo Library Sync Endpoint
POST {{baseURL}}/api/sync/kobo/markup
Authorization: Bearer {{koboToken}}
x-kobo-device: {"DeviceId":"kobo-clara-test","Model":"Kobo Clara","SerialNumber":"N123456789"}
{
"ReadingSync": [
{
"ContentId": "book-uuid-here",
"PercentRead": 45.6,
"EntitlementId": "entitlement-id",
"RemainingTimeMinutes": 120,
"LastModified": "2026-01-30T20:00:00Z"
}
],
"BookmarkSync": [
{
"BookmarkId": "bookmark-id-1",
"ContentId": "book-uuid-here",
"BookmarkText": "highlighted text here",
"BookmarkType": "annotation",
"BookmarkTitle": "Chapter 3"
}
]
}
### Kobo Bookmark Sync Endpoint
POST {{baseURL}}/api/sync/kobo/bookmark
Authorization: Bearer {{koboToken}}
x-kobo-device: {"DeviceId":"kobo-clara-test","Model":"Kobo Clara","SerialNumber":"N123456789"}
{
"BookmarkSync": [
{
"BookmarkId": "bookmark-id-2",
"ContentId": "book-uuid-here",
"BookmarkText": "This is my note abouts book",
"BookmarkType": "bookmark",
"BookmarkTitle": "Important note"
}
]
}
### Kobo Analytics Tests Endpoint
POST {{baseURL}}/api/sync/kobo/v1/analytics/gettests
Authorization: Bearer {{koboToken}}
x-kobo-device: {"DeviceId":"kobo-clara-test","Model":"Kobo Clara","SerialNumber":"N123456789"}
{
"ContentId": "book-uuid-here",
"ReadingEvent": "Reading",
"RemainingTimeMin": 180,
"PercentRead": 67.8
}
+84 -38
View File
@@ -1,44 +1,90 @@
meta {
name: Server Sync to Kobo
name: Sync from Bookhoard to Kobo
type: http
seq: 1
}
POST {{baseURL}}/api/sync/kobo/sync-from-server
Authorization: Bearer {{koboToken}}
x-kobo-device: {"DeviceId":"kobo-clara-test","Model":"Kobo Clara","SerialNumber":"N123456789"}
Content-Type: application/json
[
{
"ContentId": "{{bookUUID}}",
"PercentRead": 65.4,
"LastModified": "2026-01-31T12:00:00Z",
"Bookmarks": [
{
"BookmarkId": "bookmark-123",
"ContentId": "{{bookUUID}}",
"BookmarkText": "This is an important note",
"BookmarkType": "bookmark",
"BookmarkTitle": "Chapter 5 Note"
}
],
"Highlights": [
{
"BookmarkId": "highlight-456",
"ContentId": "{{bookUUID}}",
"BookmarkText": "highlighted passage text",
"BookmarkType": "annotation",
"BookmarkTitle": "Chapter 3 Highlight"
}
]
}
]
{
"meta": {
"name": "Sync from Bookhoard to Kobo",
"description": "Server-initiated sync pushing progress, bookmarks, and highlights from Bookhoard to Kobo device",
"documentation": "Two-way sync endpoint. Allows Bookhoard server to push updates to Kobo device, including reading progress, bookmarks, and highlights."
}
post {
url: {{baseURL}}/api/sync/kobo/sync-from-server
body: json
auth: inherit
}
headers {
Authorization: Bearer {{koboToken}}
Content-Type: application/json
x-kobo-device: {"DeviceId":"kobo-clara-test","Model":"Kobo Clara","SerialNumber":"N123456789"}
}
body:json {
[
{
"ContentId": "{{bookUUID}}",
"PercentRead": 65.4,
"LastModified": "2026-01-31T12:00:00Z",
"Bookmarks": [
{
"BookmarkId": "bookmark-123",
"ContentId": "{{bookUUID}}",
"BookmarkText": "This is an important note",
"BookmarkType": "bookmark",
"BookmarkTitle": "Chapter 5 Note"
}
],
"Highlights": [
{
"BookmarkId": "highlight-456",
"ContentId": "{{bookUUID}}",
"BookmarkText": "highlighted passage text",
"BookmarkType": "annotation",
"BookmarkTitle": "Chapter 3 Highlight"
}
]
}
]
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Sync from Bookhoard to Kobo
Server-initiated sync pushing progress, bookmarks, and highlights from Bookhoard to Kobo device. Two-way sync endpoint.
**Method:** POST
**Endpoint:** /api/sync/kobo/sync-from-server
**Authentication:** Bearer token with Kobo device identification
**Headers:**
- `x-kobo-device` (string): JSON string containing Kobo device info
- `DeviceId`: Kobo device ID
- `Model`: Kobo device model
- `SerialNumber`: Kobo device serial number
**Request Body:** Array of sync data objects
- `ContentId` (string): Book UUID
- `PercentRead` (number): Reading progress percentage (0-100)
- `LastModified` (string): ISO 8601 timestamp
- `Bookmarks` (array, optional): Array of bookmark objects
- `BookmarkId`: Unique bookmark ID
- `ContentId`: Book UUID
- `BookmarkText`: Bookmark text/note
- `BookmarkType`: Type (bookmark, annotation, etc.)
- `BookmarkTitle`: Bookmark title
- `Highlights` (array, optional): Array of highlight objects (same structure as bookmarks)
**Response:**
- Sync result confirmation
**Status Codes:**
- 200: Success
- 401: Unauthorized
- 500: Internal server error
**Note:** Allows Bookhoard server to push updates to Kobo device, including reading progress, bookmarks, and highlights.
}
+55 -10
View File
@@ -1,12 +1,22 @@
meta {
name: "Kobo Bookmark Sync - Enhanced with ContentId Mapping"
name: Kobo Bookmark Sync
type: http
seq: 3
}
post {
url: {{base_url}}/api/v1/kobo/bookmark
body: json({
body: json
auth: inherit
}
headers {
Authorization: Bearer {{device_token}}
Content-Type: application/json
}
body:json {
{
"BookmarkSync": [
{
"BookmarkId": "bookmark_2",
@@ -16,15 +26,50 @@ post {
"DateCreated": "2026-01-31T12:00:00Z"
}
]
})
auth: {
type: bearer
bearer: {{device_token}}
}
}
assert {
response.status == 200
response.body.Status == "Success"
response.body.BookmarksSynced >= 0
script:post-response {
function onResponse(res) {
if (res.getStatus() === 200) {
const body = res.getBody();
tests('Status is Success', body.Status === "Success");
tests('BookmarksSynced >= 0', body.BookmarksSynced >= 0);
}
}
onResponse(res);
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Kobo Bookmark Sync
Synchronizes bookmarks from a Kobo device to the Bookhoard server.
**Method:** POST
**Endpoint:** /api/v1/kobo/bookmark
**Authentication:** Bearer token (device token)
**Request Body:**
- `BookmarkSync` (array): Array of bookmark objects
- `BookmarkId` (string): Unique bookmark ID
- `ContentId` (string): Book/content ID
- `BookmarkText` (string): Bookmark text or note
- `BookmarkType` (string): Type (bookmark, highlight, note)
- `DateCreated` (string): ISO 8601 timestamp
**Response:**
- `Status` (string): Sync status (Success, Partial)
- `BookmarksSynced` (number): Number of bookmarks synced
**Status Codes:**
- 200: Success
- 401: Unauthorized
- 500: Internal server error
}
+44 -10
View File
@@ -1,5 +1,5 @@
meta {
name: "Kobo Initialization - Enhanced with ContentId Mapping"
name: Kobo Initialization
type: http
seq: 1
}
@@ -7,15 +7,49 @@ meta {
get {
url: {{base_url}}/api/v1/kobo/initialization
body: none
auth: {
type: bearer
bearer: {{device_token}}
}
auth: inherit
}
assert {
response.status == 200
response.body.ContentId exists()
response.body.Categories exists()
response.body.BookhoardUUID exists()
headers {
Authorization: Bearer {{device_token}}
Content-Type: application/json
}
script:post-response {
function onResponse(res) {
if (res.getStatus() === 200) {
const body = res.getBody();
tests('Has ContentId', body.ContentId !== undefined);
tests('Has Categories', body.Categories !== undefined);
tests('Has BookhoardUUID', body.BookhoardUUID !== undefined);
}
}
onResponse(res);
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Kobo Initialization
Initializes Kobo device sync, returning device resources and account information.
**Method:** GET
**Endpoint:** /api/v1/kobo/initialization
**Authentication:** Bearer token (device token)
**Response:**
- `ContentId` (string): Device content ID
- `Categories` (array): Available categories/collections
- `BookhoardUUID` (string): Bookhoard instance UUID
**Status Codes:**
- 200: Success
- 401: Unauthorized
- 500: Internal server error
}
+65 -11
View File
@@ -1,12 +1,22 @@
meta {
name: "Kobo Markup Sync - Enhanced with ContentId Mapping"
name: Kobo Markup Sync
type: http
seq: 2
}
post {
url: {{base_url}}/api/v1/kobo/markup
body: json({
body: json
auth: inherit
}
headers {
Authorization: Bearer {{device_token}}
Content-Type: application/json
}
body:json {
{
"ReadingSync": [
{
"ContentId": "kobo_abc123def456",
@@ -26,16 +36,60 @@ post {
}
],
"Metadata": true
})
auth: {
type: bearer
bearer: {{device_token}}
}
}
assert {
response.status == 200
response.body.Status == "Success" || response.body.Status == "Partial"
response.body.MarkupsSynced >= 0
response.body.BookmarksSynced >= 0
script:post-response {
function onResponse(res) {
if (res.getStatus() === 200) {
const body = res.getBody();
const validStatus = body.Status === "Success" || body.Status === "Partial";
tests('Status is Success or Partial', validStatus);
tests('MarkupsSynced >= 0', body.MarkupsSynced >= 0);
tests('BookmarksSynced >= 0', body.BookmarksSynced >= 0);
}
}
onResponse(res);
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Kobo Markup Sync
Synchronizes reading progress and markup (highlights, bookmarks) from a Kobo device.
**Method:** POST
**Endpoint:** /api/v1/kobo/markup
**Authentication:** Bearer token (device token)
**Request Body:**
- `ReadingSync` (array, optional): Reading progress data
- `ContentId` (string): Book/content ID
- `PercentRead` (number): Percentage read (0-100)
- `RemainingTimeMin` (number): Remaining time in minutes
- `ReadingEvent` (string): Event type (BookRead, etc.)
- `LastModified` (string): ISO 8601 timestamp
- `BookmarkSync` (array, optional): Bookmark/highlight data
- `BookmarkId` (string): Unique bookmark ID
- `ContentId` (string): Book/content ID
- `BookmarkText` (string): Highlighted/bookmarked text
- `BookmarkType` (string): Type (annotation, bookmark)
- `DateCreated` (string): ISO 8601 timestamp
- `Metadata` (boolean): Whether to include metadata
**Response:**
- `Status` (string): Sync status (Success, Partial)
- `MarkupsSynced` (number): Number of markups synced
- `BookmarksSynced` (number): Number of bookmarks synced
**Status Codes:**
- 200: Success
- 401: Unauthorized
- 500: Internal server error
}