This commit is contained in:
seb
2026-10-30 18:09:31 +01:00
parent 5fac537268
commit 8fece9d916
13 changed files with 642 additions and 3 deletions

View File

@@ -37,6 +37,10 @@ Generated from `@openapi` annotations in [`src/api/routes/`](../../src/api/route
| [`routes/account.get.md`](routes/account.get.md) | `GET /account` |
| [`routes/account.post.md`](routes/account.post.md) | `POST /account` |
| [`routes/account/_id.md`](routes/account/_id.md) | `DELETE /account/{id}` |
| [`routes/agent/events.md`](routes/agent/events.md) | `GET /agent/events` |
| [`routes/agent/pair.get.md`](routes/agent/pair.get.md) | `GET /agent/pair` |
| [`routes/agent/pair.post.md`](routes/agent/pair.post.md) | `POST /agent/pair` |
| [`routes/agent/state.md`](routes/agent/state.md) | `POST /agent/state` |
| [`routes/article/create.md`](routes/article/create.md) | `POST /article` |
| [`routes/article/export.zip.md`](routes/article/export.zip.md) | `GET /article/export.zip` |
| [`routes/article/history-list.md`](routes/article/history-list.md) | `GET /article/history` |

View File

@@ -1,6 +1,6 @@
# Dash API Routes Overview (All)
Overview of all 288 API endpoints across all modules.
Overview of all 292 API endpoints across all modules.
### Notation
@@ -73,6 +73,21 @@ _none_
- Params: `id: int`
- Returns: `204 void`
### Section: /agent
#### Printer agent SSE stream — `GET /agent/events`
- Params: `query: token?: str, agentversion?: str`
- Returns: `200 SSE`
#### Pair printer agent via query parameters — `GET /agent/pair`
- Params: `query: authCode?: str, pairingpin?: str, serial?: str, model?: str, version?: str`
- Returns: `200`
#### Pair printer agent — `POST /agent/pair`
- Params: `body: { pairingpin: str, clientserial?: str, clientmodel?: str, agentversion?: str }`
- Returns: `200 { id: int, name: str, companyId: int, token: str, pairedAt: str, clientserial: str|null, clientmodel: str|null, agentversion: str|null, sort: int }`
#### Post agent state — `POST /agent/state`
- Params: `body: { state?: any }`
- Returns: `200 { success: bool, agent: T8 }`
### Section: /article
#### Create article in category — `POST /article`

View File

@@ -1,6 +1,6 @@
# Dash API Routes Overview
Overview of all 208 API endpoints across all modules.
Overview of all 212 API endpoints across all modules.
### Notation
@@ -42,6 +42,21 @@ Params: path values first, then `query:` and `body:` (`body?` = optional body).
### Routes
### Section: /agent
#### Printer agent SSE stream — `GET /agent/events`
- Params: `query: token?: str, agentversion?: str`
- Returns: `200 SSE`
#### Pair printer agent via query parameters — `GET /agent/pair`
- Params: `query: authCode?: str, pairingpin?: str, serial?: str, model?: str, version?: str`
- Returns: `200`
#### Pair printer agent — `POST /agent/pair`
- Params: `body: { pairingpin: str, clientserial?: str, clientmodel?: str, agentversion?: str }`
- Returns: `200 { id: int, name: str, companyId: int, token: str, pairedAt: str, clientserial: str|null, clientmodel: str|null, agentversion: str|null, sort: int }`
#### Post agent state — `POST /agent/state`
- Params: `body: { state?: any }`
- Returns: `200 { success: bool, agent: T5 }`
### Section: /article
#### Create article in category — `POST /article`

View File

@@ -0,0 +1,30 @@
# `GET /agent/events`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Printer agent SSE stream
Authorized Server-Sent Events stream for connected printer agents.
Maintains a persistent connection with regular heartbeats (`: heartbeat\n\n`) and updates `lastseen_at` and `agentversion`.
## Query parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `token` | no | string | Agent auth token if not provided via Authorization header |
| `agentversion` | no | string | Current agent version |
## Response `200`
Event stream established
## Errors
| Status | Description |
|--------|-------------|
| 401 | Unauthorized |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,31 @@
# `GET /agent/pair`
Public. No cookie required.
Pair printer agent via query parameters
Alternative GET endpoint for devices that pair via query parameters.
## Query parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `authCode` | no | string | Pairing PIN (or pairingpin) |
| `pairingpin` | no | string | |
| `serial` | no | string | |
| `model` | no | string | |
| `version` | no | string | |
## Response `200`
Pairing successful
## Errors
| Status | Description |
|--------|-------------|
| 400 | Missing or invalid pairing PIN |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,55 @@
# `POST /agent/pair`
Public. No cookie required.
Pair printer agent
Public, unauthorized endpoint used by the printer agent to complete pairing using a 6-digit PIN.
Updates `clientserial`, `clientmodel`, and `agentversion`, clears the pairing PIN, and returns a device authentication token.
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `pairingpin` | yes | string | |
| `clientserial` | no | string | |
| `clientmodel` | no | string | |
| `agentversion` | no | string | |
```json
{
"pairingpin": "123456",
"clientserial": "SN-987654321",
"clientmodel": "Epson TM-T88VI",
"agentversion": "1.0.0"
}
```
## Response `200`
Pairing successful
```json
{
"id": 1,
"name": "…",
"companyId": 1,
"token": "…",
"pairedAt": "…",
"clientserial": "…",
"clientmodel": "…",
"agentversion": "…",
"sort": 1
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Missing or invalid pairing PIN — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,55 @@
# `POST /agent/state`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Post agent state
Authorized endpoint for the printer agent to report its operational status/telemetry.
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `state` | no | | Status text or status object |
```json
{
"state": "…"
}
```
## Response `200`
State recorded
```json
{
"success": true,
"agent": {
"id": 1,
"companyId": 1,
"name": "…",
"token": "…",
"pairingpin": "…",
"pairedAt": "…",
"clientserial": "…",
"clientmodel": "…",
"clientstate": "…",
"agentversion": "…",
"lastseenAt": "…",
"updatedAt": "…",
"sort": 1
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 401 | Unauthorized |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._