Add a rules controller

This commit is contained in:
Dan Milne
2025-11-04 09:47:11 +11:00
parent 5ff166613e
commit c72d83acda
14 changed files with 272 additions and 42 deletions

View File

@@ -200,7 +200,7 @@ GET /api/:public_key/rules/version
Response:
{
"version": "2024-11-03T12:30:45.123Z",
"version": 1730646645123000,
"count": 150,
"sampling": {
"allowed_requests": 0.5,
@@ -211,14 +211,16 @@ Response:
}
```
**Timestamp Format**: The `version` field uses **microsecond Unix timestamp** (e.g., `1730646645123000`) for efficient machine comparison. For backward compatibility, the API also accepts ISO8601 timestamps in the `since` parameter.
#### 2. Incremental Sync
```http
GET /api/:public_key/rules?since=2024-11-03T12:00:00.000Z
GET /api/:public_key/rules?since=1730646000000000
Response:
{
"version": "2024-11-03T12:30:45.123Z",
"version": 1730646645123000,
"sampling": { ... },
"rules": [
{
@@ -257,7 +259,7 @@ GET /api/:public_key/rules
Response:
{
"version": "2024-11-03T12:30:45.123Z",
"version": 1730646645123000,
"sampling": { ... },
"rules": [ ...all enabled rules... ]
}