Update configuration key naming convention to use snake_case consistently. Applies changes recursively across all subdirectories.
96 lines
2.3 KiB
Plaintext
96 lines
2.3 KiB
Plaintext
meta {
|
|
name: Get Reading Stats Date Range
|
|
type: http
|
|
seq: 3
|
|
}
|
|
|
|
get {
|
|
url: {{base_url}}/api/analytics/reading-stats?start_date=2024-01-01&end_date=2024-01-31
|
|
body: none
|
|
auth: inherit
|
|
}
|
|
|
|
tests {
|
|
test("status must be 200", function() {
|
|
expect(res.status).to.eql(200);
|
|
});
|
|
|
|
test("response has daily_reading_minutes array", function() {
|
|
const body = JSON.parse(res.body);
|
|
expect(body).to.have.property("daily_reading_minutes");
|
|
expect(body.daily_reading_minutes).to.be.an("array");
|
|
});
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
timeout: 0
|
|
}
|
|
|
|
docs {
|
|
Get reading statistics for a specific date range.
|
|
|
|
**Endpoint**: GET /api/analytics/reading-stats
|
|
**Auth**: Required (Bearer token)
|
|
|
|
## Query Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
|-----------|------|-----------|-------------|
|
|
| start_date | string | No | Start date (ISO 8601 format, default: 30 days ago) |
|
|
| end_date | string | No | End date (ISO 8601 format, default: today) |
|
|
|
|
## Response Fields
|
|
|
|
| Field | Type | Description |
|
|
|-------|------|-------------|
|
|
| total_books_read | int | Total books completed in range |
|
|
| total_pages_read | int | Total pages read in range |
|
|
| total_reading_time_minutes | int | Total reading time in minutes |
|
|
| completion_rate | float | Percentage of books completed (0-1) |
|
|
| daily_reading_minutes | array | Daily reading time per day |
|
|
| daily_reading_minutes[].date | string | Date (ISO 8601) |
|
|
| daily_reading_minutes[].minutes | int | Minutes read on that date |
|
|
|
|
## Example Request
|
|
|
|
```
|
|
GET /api/analytics/reading-stats?start_date=2024-01-01&end_date=2024-01-31
|
|
```
|
|
|
|
## Example Response
|
|
|
|
```json
|
|
{
|
|
"total_books_read": 2,
|
|
"total_pages_read": 450,
|
|
"total_reading_time_minutes": 720,
|
|
"completion_rate": 0.85,
|
|
"daily_reading_minutes": [
|
|
{
|
|
"date": "2024-01-01",
|
|
"minutes": 30
|
|
},
|
|
{
|
|
"date": "2024-01-02",
|
|
"minutes": 45
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
## Error Responses
|
|
|
|
| Code | Description |
|
|
|------|-------------|
|
|
| 400 | Invalid date format |
|
|
| 401 | Unauthorized |
|
|
| 500 | Internal server error |
|
|
|
|
## Notes
|
|
|
|
- Dates must be in ISO 8601 format (YYYY-MM-DD)
|
|
- The range is inclusive of both start and end dates
|
|
- Daily data only includes days with reading activity > 0
|
|
}
|