pinakes/docs/api/analytics.md
NotAShelf 9e5eb41d39
nix: set up project-wide formatter
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I4806c58aa0a17f504c9312723ad770166a6a6964
2026-03-22 23:58:28 +03:00

116 lines
2.5 KiB
Markdown
Vendored

# Analytics
Usage analytics and viewing history
## Endpoints
### POST /api/v1/analytics/events
**Authentication:** Required (Bearer JWT)
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Event recorded |
| 401 | Unauthorized |
| 500 | Internal server error |
---
### GET /api/v1/analytics/most-viewed
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| -------- | ----- | -------- | ------------------------- |
| `limit` | query | No | Maximum number of results |
| `offset` | query | No | Pagination offset |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Most viewed media |
| 401 | Unauthorized |
| 500 | Internal server error |
---
### GET /api/v1/analytics/recently-viewed
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| -------- | ----- | -------- | ------------------------- |
| `limit` | query | No | Maximum number of results |
| `offset` | query | No | Pagination offset |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Recently viewed media |
| 401 | Unauthorized |
| 500 | Internal server error |
---
### GET /api/v1/media/{id}/progress
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Watch progress |
| 401 | Unauthorized |
| 404 | Not found |
| 500 | Internal server error |
---
### PUT /api/v1/media/{id}/progress
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Progress updated |
| 400 | Bad request |
| 401 | Unauthorized |
| 404 | Not found |
| 500 | Internal server error |
---