Files
bookhoard/bruno/collections/scenarios/Test Collection Rules.yml
T
john-okeefe f859b2714d refactor(bruno): reorganize file structure from bruno-yaml to flat bruno directory
- Move all files from bruno-yaml/* to bruno/*
- Maintains existing directory structure within categories
- Updates bruno/user/auth files with OAuth2 refresh token flow
- Updates bruno/user/profile files for user profile management
- Adds bruno/dashboard/ directory with dashboard API tests
- Preserves all existing test scenarios and OpenCollection YAML format
- No functional changes - file reorganization only
2026-02-17 20:22:21 -05:00

68 lines
2.1 KiB
YAML

info:
name: Test Collection Rules
type: http
seq: 1
http:
method: POST
url: '{{base_url}}/api/collections/test-rules'
auth: inherit
body:
type: json
jsonBody: "{\n \"rules\": [\n {\n \"field\": \"genre\",\n \
\ \"operator\": \"equals\",\n \"value\": \"Science Fiction\""
headers:
- key: Content-Type
value: application/json
- key: Authorization
value: Bearer {{authToken
docs: |-
## Test Collection Rules
Tests collection rules against the library to see which books match, without creating a collection. Useful for previewing what books would be included in a collection with specific rules.
**Method:** POST
**Endpoint:** /api/collections/test-rules
**Authentication:** Bearer token
**Request Body:**
- `rules` (array): Array of rule objects to test
- `field` (string): Field to test (genre, author, copyright_year, tags, etc.)
- `operator` (string): Comparison operator
- `equals`: Exact match
- `contains`: Contains substring (for text fields)
- `greater_than`: Greater than (for numeric fields)
- `less_than`: Less than (for numeric fields)
- `not_equals`: Not equal to
- `starts_with`: Starts with
- `ends_with`: Ends with
- `is_empty`: Field is empty or null
- `is_not_empty`: Field is not empty and not null
- `value` (string): Value to compare against (not required for is_empty/is_not_empty)
**Response:**
- `matches` (array): Array of matching books
- `id` (string): Book UUID
- `title` (string): Book title
- `author` (string): Book author
- `genre` (string): Book genre
- Additional book metadata
- `total` (number): Total number of matching books
**Status Codes:**
- 200: Success - returns matching books
- 400: Invalid request (empty rules array, invalid field/operator)
- 401: Unauthorized
- 500: Internal server error
**Example Request:**
```json
{
"rules": [
{
"field": "genre",
"operator": "equals",
"value": "Science Fiction"