feat: add Twitch OAuth response contracts

This commit is contained in:
2026-10-25 04:36:50 +01:00
parent d5a4027708
commit 2760f0234f
5 changed files with 49 additions and 0 deletions
+2
View File
@@ -9,4 +9,6 @@ server readiness, health, errors, and the transport-neutral realtime event
envelope so the client and server can be developed and tested together before
Twitch integration. It also defines the first administrator authentication
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.
@@ -0,0 +1,23 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://trixie.reaperofveriod.nl/contracts/v1/twitch-oauth-link-response.json",
"title": "Twitch OAuth authorization link response",
"type": "object",
"additionalProperties": false,
"required": ["identity", "scopes", "authorization_url", "expires_in_seconds"],
"properties": {
"identity": { "enum": ["streamer", "bot", "moderator"] },
"scopes": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"minItems": 1,
"uniqueItems": true
},
"authorization_url": {
"type": "string",
"format": "uri",
"pattern": "^https://id\\.twitch\\.tv/oauth2/authorize\\?"
},
"expires_in_seconds": { "type": "integer", "const": 600 }
}
}
+13
View File
@@ -0,0 +1,13 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://trixie.reaperofveriod.nl/contracts/v1/twitch-oauth-result.json",
"title": "Twitch OAuth completion response",
"type": "object",
"additionalProperties": false,
"required": ["identity", "twitch_user_id", "display_name"],
"properties": {
"identity": { "enum": ["streamer", "bot", "moderator"] },
"twitch_user_id": { "type": "string", "minLength": 1 },
"display_name": { "type": "string", "minLength": 1 }
}
}
@@ -0,0 +1,6 @@
{
"identity": "bot",
"scopes": ["channel:bot", "user:read:chat", "user:write:chat"],
"authorization_url": "https://id.twitch.tv/oauth2/authorize?client_id=public-example-client&redirect_uri=http%3A%2F%2Flocalhost%3A8787%2Fapi%2Fv1%2Ftwitch%2Foauth%2Fcallback&response_type=code&scope=channel%3Abot+user%3Aread%3Achat+user%3Awrite%3Achat&state=synthetic-state",
"expires_in_seconds": 600
}
@@ -0,0 +1,5 @@
{
"identity": "streamer",
"twitch_user_id": "synthetic-twitch-user-id",
"display_name": "SyntheticStreamer"
}