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:
@@ -4,23 +4,62 @@ meta {
|
||||
seq: 1
|
||||
}
|
||||
|
||||
POST {{baseURL}}/api/devices/{{deviceID}}/shelves
|
||||
Authorization: Bearer {{userToken}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"media_item_ids": [
|
||||
"{{bookUUID1}}",
|
||||
"{{bookUUID2}}"
|
||||
],
|
||||
"shelf_name": "Reading List",
|
||||
"shelf_position": 0
|
||||
post {
|
||||
url: {{baseURL}}/api/devices/{{deviceID}}/shelves
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
{
|
||||
"meta": {
|
||||
"name": "Add Books to Kobo Shelf",
|
||||
"description": "Add one or more books to a Kobo device shelf",
|
||||
"documentation": "Manages which books should be synced to a specific Kobo device. Supports multiple shelves for organization."
|
||||
headers {
|
||||
Authorization: Bearer {{userToken}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"media_item_ids": [
|
||||
"{{bookUUID1}}",
|
||||
"{{bookUUID2}}"
|
||||
],
|
||||
"shelf_name": "Reading List",
|
||||
"shelf_position": 0
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Add Books to Kobo Shelf
|
||||
|
||||
Add one or more books to a Kobo device shelf. Manages which books should be synced to a specific Kobo device. Supports multiple shelves for organization.
|
||||
|
||||
**Method:** POST
|
||||
|
||||
**Endpoint:** /api/devices/{deviceID}/shelves
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Path Parameters:**
|
||||
- `deviceID` (string): Device UUID
|
||||
|
||||
**Request Body:**
|
||||
- `media_item_ids` (array): Array of book UUIDs to add
|
||||
- `shelf_name` (string): Name of the shelf (e.g., "Reading List", "Favorites")
|
||||
- `shelf_position` (number, optional): Position on the shelf (default: 0)
|
||||
|
||||
**Response:**
|
||||
- `message` (string): Success message
|
||||
- `added_count` (number): Number of books added
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success - books added to shelf
|
||||
- 400: Invalid request data
|
||||
- 401: Unauthorized
|
||||
- 404: Device or one or more books not found
|
||||
- 500: Internal server error
|
||||
|
||||
**Note:** Adding a book that's already on the shelf updates its position if a new position is specified. Supports multiple shelves for organizing content on the Kobo device.
|
||||
}
|
||||
|
||||
@@ -7,36 +7,32 @@ meta {
|
||||
get {
|
||||
url: {{base_url}}/api/devices/approve/{{registration_id}}
|
||||
body: none
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
headers: {
|
||||
Authorization: Bearer {{token}}
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
docs {
|
||||
## Approve Device Registration
|
||||
|
||||
|
||||
Approves a pending device registration request.
|
||||
|
||||
|
||||
**Method:** GET
|
||||
|
||||
|
||||
**Endpoint:** /api/devices/approve/:registration_id
|
||||
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
|
||||
**Path Parameters:**
|
||||
- `registration_id` (string): Registration request UUID
|
||||
|
||||
|
||||
**Response:**
|
||||
- Success message with approved device details
|
||||
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 404: Registration not found
|
||||
- 400: Invalid registration status
|
||||
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -4,13 +4,47 @@ meta {
|
||||
seq: 1
|
||||
}
|
||||
|
||||
DELETE {{baseURL}}/api/devices/{{deviceID}}/shelves/clear?shelf={{shelfName}}
|
||||
Authorization: Bearer {{userToken}}
|
||||
|
||||
{
|
||||
"meta": {
|
||||
"name": "Clear Kobo Shelf",
|
||||
"description": "Clear all books from a Kobo device shelf (or all shelves if no shelf name specified)",
|
||||
"documentation": "Removes all books from the specified shelf. If no shelf name is provided, clears all shelves for the device."
|
||||
}
|
||||
delete {
|
||||
url: {{baseURL}}/api/devices/{{deviceID}}/shelves/clear?shelf={{shelfName}}
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Authorization: Bearer {{userToken}}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Clear Kobo Shelf
|
||||
|
||||
Clear all books from a Kobo device shelf, or all shelves if no shelf name is specified.
|
||||
|
||||
**Method:** DELETE
|
||||
|
||||
**Endpoint:** /api/devices/{deviceID}//shelves/clear?shelf={shelfName}
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Path Parameters:**
|
||||
- `deviceID` (string): Device UUID
|
||||
|
||||
**Query Parameters:**
|
||||
- `shelf` (string, optional): Shelf name to clear. If omitted, clears all shelves.
|
||||
|
||||
**Response:**
|
||||
- `message` (string): Success message
|
||||
- `cleared_count` (number): Number of books removed from shelf
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success - shelf cleared
|
||||
- 401: Unauthorized
|
||||
- 404: Device not found
|
||||
- 500: Internal server error
|
||||
|
||||
**Note:** Removes all books from the specified shelf. If no shelf name is provided, clears all shelves for the device. This operation cannot be undone.
|
||||
}
|
||||
|
||||
@@ -7,9 +7,39 @@ meta {
|
||||
delete {
|
||||
url: {{baseUrl}}/api/devices/{{deviceId}}
|
||||
body: none
|
||||
auth: bearer
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers: {
|
||||
headers {
|
||||
Authorization: Bearer {{token}}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Delete Device
|
||||
|
||||
Deletes a device and unregisters it from the user's account.
|
||||
|
||||
**Method:** DELETE
|
||||
|
||||
**Endpoint:** /api/devices/{deviceId}
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Path Parameters:**
|
||||
- `deviceId` (string): Device UUID
|
||||
|
||||
**Response:** 204 No Content on success
|
||||
|
||||
**Status Codes:**
|
||||
- 204: Success - device deleted
|
||||
- 401: Unauthorized
|
||||
- 404: Device not found
|
||||
- 500: Internal server error
|
||||
|
||||
**Note:** This action cannot be undone. All device data and sync history will be removed.
|
||||
}
|
||||
|
||||
@@ -7,9 +7,44 @@ meta {
|
||||
get {
|
||||
url: {{baseUrl}}/api/devices/{{deviceId}}
|
||||
body: none
|
||||
auth: bearer
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers: {
|
||||
headers {
|
||||
Authorization: Bearer {{token}}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Get Device
|
||||
|
||||
Retrieves detailed information about a specific device.
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**Endpoint:** /api/devices/{deviceId}
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Path Parameters:**
|
||||
- `deviceId` (string): Device UUID
|
||||
|
||||
**Response:**
|
||||
- `id` (string): Device UUID
|
||||
- `name` (string): Device name
|
||||
- `device_type` (string): Type (kobo, koreader, web)
|
||||
- `last_sync` (string): Last sync timestamp
|
||||
- `is_active` (boolean): Whether device is active
|
||||
- `created_at` (string): Registration timestamp
|
||||
- `sync_settings` (object): Device-specific sync settings
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 404: Device not found
|
||||
- 500: Internal server error
|
||||
}
|
||||
|
||||
@@ -1,16 +1,56 @@
|
||||
meta {
|
||||
name: Get Kobo Shelf
|
||||
name: Get Kobo Shelf Books
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
GET {{baseURL}}/api/devices/{{deviceID}}/shelves?shelf={{shelfName}}
|
||||
Authorization: Bearer {{userToken}}
|
||||
|
||||
{
|
||||
"meta": {
|
||||
"name": "Get Kobo Shelf Books",
|
||||
"description": "Get all books on a Kobo device shelf, optionally filter by shelf name",
|
||||
"documentation": "Returns a list of books with their shelf positions and Kobo-specific metadata (entitlement ID, revision number)."
|
||||
}
|
||||
get {
|
||||
url: {{baseURL}}/api/devices/{{deviceID}}/shelves?shelf={{shelfName}}
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Authorization: Bearer {{userToken}}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Get Kobo Shelf Books
|
||||
|
||||
Get all books on a Kobo device shelf, optionally filter by shelf name.
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**Endpoint:** /api/devices/{deviceID}/shelves?shelf={shelfName}
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Path Parameters:**
|
||||
- `deviceID` (string): Device UUID
|
||||
|
||||
**Query Parameters:**
|
||||
- `shelf` (string, optional): Shelf name to filter by. If omitted, returns all shelves.
|
||||
|
||||
**Response:**
|
||||
- Array of books with:
|
||||
- `id` (string): Book UUID
|
||||
- `title` (string): Book title
|
||||
- `author` (string): Book author
|
||||
- `shelf_name` (string): Name of the shelf
|
||||
- `shelf_position` (number): Position on the shelf
|
||||
- `entitlement_id` (string): Kobo entitlement ID
|
||||
- `revision_id` (string): Kobo revision number
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 404: Device not found
|
||||
- 500: Internal server error
|
||||
|
||||
**Note:** Returns Kobo-specific metadata (entitlement ID, revision number) required for proper Kobo sync operations.
|
||||
}
|
||||
|
||||
@@ -7,9 +7,40 @@ meta {
|
||||
get {
|
||||
url: {{baseUrl}}/api/devices
|
||||
body: none
|
||||
auth: bearer
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers: {
|
||||
headers {
|
||||
Authorization: Bearer {{token}}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## List Devices
|
||||
|
||||
Lists all devices registered to the authenticated user's account.
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**Endpoint:** /api/devices
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Response:**
|
||||
- `devices` (array): Array of device objects
|
||||
- `id` (string): Device UUID
|
||||
- `name` (string): Device name
|
||||
- `device_type` (string): Type (kobo, koreader, web)
|
||||
- `last_sync` (string): Last sync timestamp
|
||||
- `is_active` (boolean): Whether device is active
|
||||
- `created_at` (string): Registration timestamp
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 500: Internal server error
|
||||
}
|
||||
|
||||
@@ -7,31 +7,27 @@ meta {
|
||||
get {
|
||||
url: {{base_url}}/api/devices/pending
|
||||
body: none
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
headers: {
|
||||
Authorization: Bearer {{token}}
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
docs {
|
||||
## List Pending Device Registrations
|
||||
|
||||
|
||||
Retrieves all pending device registration requests awaiting approval.
|
||||
|
||||
|
||||
**Method:** GET
|
||||
|
||||
|
||||
**Endpoint:** /api/devices/pending
|
||||
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
|
||||
**Response:**
|
||||
- Array of pending device registrations
|
||||
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
[
|
||||
|
||||
@@ -7,36 +7,32 @@ meta {
|
||||
post {
|
||||
url: {{base_url}}/api/devices/reject/{{registration_id}}
|
||||
body: none
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
headers: {
|
||||
Authorization: Bearer {{token}}
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
docs {
|
||||
## Reject Device Registration
|
||||
|
||||
|
||||
Rejects a pending device registration request.
|
||||
|
||||
|
||||
**Method:** POST
|
||||
|
||||
|
||||
**Endpoint:** /api/devices/reject/:registration_id
|
||||
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
|
||||
**Path Parameters:**
|
||||
- `registration_id` (string): Registration request UUID
|
||||
|
||||
|
||||
**Response:**
|
||||
- Success message confirming rejection
|
||||
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 404: Registration not found
|
||||
- 400: Invalid registration status
|
||||
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -4,13 +4,46 @@ meta {
|
||||
seq: 1
|
||||
}
|
||||
|
||||
DELETE {{baseURL}}/api/devices/{{deviceID}}/shelves?media_item_id={{bookUUID}}
|
||||
Authorization: Bearer {{userToken}}
|
||||
|
||||
{
|
||||
"meta": {
|
||||
"name": "Remove Book from Kobo Shelf",
|
||||
"description": "Remove a specific book from a Kobo device shelf",
|
||||
"documentation": "Removes the book from the device's shelf, preventing it from syncing to that device."
|
||||
}
|
||||
delete {
|
||||
url: {{baseURL}}/api/devices/{{deviceID}}/shelves?media_item_id={{bookUUID}}
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Authorization: Bearer {{userToken}}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Remove Book from Kobo Shelf
|
||||
|
||||
Remove a specific book from a Kobo device shelf, preventing it from syncing to that device.
|
||||
|
||||
**Method:** DELETE
|
||||
|
||||
**Endpoint:** /api/devices/{deviceID}/shelves?media_item_id={bookUUID}
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Path Parameters:**
|
||||
- `deviceID` (string): Device UUID
|
||||
|
||||
**Query Parameters:**
|
||||
- `media_item_id` (string): Book UUID to remove from shelf
|
||||
|
||||
**Response:**
|
||||
- `message` (string): Success message
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success - book removed from shelf
|
||||
- 401: Unauthorized
|
||||
- 404: Device or book not found
|
||||
- 500: Internal server error
|
||||
|
||||
**Note:** Removing a book from the device shelf prevents it from syncing to that device in future sync operations.
|
||||
}
|
||||
|
||||
@@ -7,11 +7,7 @@ meta {
|
||||
put {
|
||||
url: {{baseUrl}}/api/devices/{{deviceId}}
|
||||
body: json
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
headers: {
|
||||
Authorization: Bearer {{token}}
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
|
||||
Reference in New Issue
Block a user