diff --git a/README.md b/README.md index 1b9d53c..fd67086 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/contracts/v1/twitch-oauth-link-response.json b/contracts/v1/twitch-oauth-link-response.json new file mode 100644 index 0000000..6e621e5 --- /dev/null +++ b/contracts/v1/twitch-oauth-link-response.json @@ -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 } + } +} diff --git a/contracts/v1/twitch-oauth-result.json b/contracts/v1/twitch-oauth-result.json new file mode 100644 index 0000000..21ea0d2 --- /dev/null +++ b/contracts/v1/twitch-oauth-result.json @@ -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 } + } +} diff --git a/fixtures/v1/twitch-oauth-link.response.json b/fixtures/v1/twitch-oauth-link.response.json new file mode 100644 index 0000000..13205f5 --- /dev/null +++ b/fixtures/v1/twitch-oauth-link.response.json @@ -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 +} diff --git a/fixtures/v1/twitch-oauth-result.response.json b/fixtures/v1/twitch-oauth-result.response.json new file mode 100644 index 0000000..a3f67e7 --- /dev/null +++ b/fixtures/v1/twitch-oauth-result.response.json @@ -0,0 +1,5 @@ +{ + "identity": "streamer", + "twitch_user_id": "synthetic-twitch-user-id", + "display_name": "SyntheticStreamer" +}