diff --git a/README.md b/README.md index fd67086..4fb61cf 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,9 @@ request and response envelopes; bearer values in fixtures are synthetic only. Twitch OAuth link and completion response envelopes are also versioned here; fixtures contain no real credentials or tokens. +The shared boundary vocabulary includes the ordered permission levels in +`contracts/v1/permissions.json` and the client/server compatibility result in +`contracts/v1/version-negotiation.json`. Server-owned state is delivered as +the authenticated `realtime-event.json` envelope; clients must ignore event +types they do not understand. + diff --git a/contracts/v1/permissions.json b/contracts/v1/permissions.json new file mode 100644 index 0000000..68d52fd --- /dev/null +++ b/contracts/v1/permissions.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://trixie.invalid/contracts/v1/permissions.json", + "title": "Trixie Permission Level", + "description": "The ordered permission levels used by chat commands and moderation controls.", + "type": "string", + "enum": ["everyone", "subscriber", "moderator", "broadcaster"] +} diff --git a/contracts/v1/version-negotiation.json b/contracts/v1/version-negotiation.json new file mode 100644 index 0000000..830191e --- /dev/null +++ b/contracts/v1/version-negotiation.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://trixie.invalid/contracts/v1/version-negotiation.json", + "title": "Trixie Version Negotiation", + "type": "object", + "additionalProperties": false, + "required": ["api_version", "client_version", "server_version", "compatible"], + "properties": { + "api_version": { "type": "string", "const": "v1" }, + "client_version": { "type": "string", "minLength": 1 }, + "server_version": { "type": "string", "minLength": 1 }, + "compatible": { "type": "boolean" }, + "reason": { "type": "string", "minLength": 1 } + } +} diff --git a/docs/versioning.md b/docs/versioning.md index 8887373..e2551fc 100644 --- a/docs/versioning.md +++ b/docs/versioning.md @@ -8,4 +8,10 @@ - `GET /api/v1/server/info` publishes `minimum_client_version` and `maximum_client_version`; clients must use these fields to detect an incompatible pairing before enabling authenticated controls. +- Permission values are shared through `contracts/v1/permissions.json`. + They are ordered from least to most privileged: `everyone`, `subscriber`, + `moderator`, and `broadcaster`. +- The normalized result of a compatibility check is described by + `contracts/v1/version-negotiation.json`; an incompatible result includes a + human-readable `reason` while a compatible result may omit it. diff --git a/fixtures/v1/version-negotiation.compatible.json b/fixtures/v1/version-negotiation.compatible.json new file mode 100644 index 0000000..3d95bfd --- /dev/null +++ b/fixtures/v1/version-negotiation.compatible.json @@ -0,0 +1,6 @@ +{ + "api_version": "v1", + "client_version": "0.1.0", + "server_version": "0.1.0", + "compatible": true +}