From 89d45f88c999bc252195db90cb804e42c4e0e385 Mon Sep 17 00:00:00 2001 From: Jacob Dent Date: Wed, 18 Nov 2026 10:42:43 -0600 Subject: [PATCH] Sync SDK spec with provable.io v1.20.0: /o/{id}/badge.svg Adds the outcome badge path to sdk/openapi.json and the regenerated openapi-types.ts, models.py and operations.py. Python gets get_outcome_badge, like get_outcome_og_image. The TypeScript coverage test skips badge.svg as it does og.png: both are images, not API calls. TypeScript tests 6/6, Python tests 9/9. --- sdk/openapi.json | 48 +++++++++++++++++++++ sdk/python/src/provableio/client.py | 5 +++ sdk/python/src/provableio/models.py | 5 +++ sdk/python/src/provableio/operations.py | 4 +- sdk/typescript/src/openapi-types.ts | 55 +++++++++++++++++++++++++ sdk/typescript/test/client.test.mjs | 4 +- 6 files changed, 117 insertions(+), 4 deletions(-) diff --git a/sdk/openapi.json b/sdk/openapi.json index 2c05d12..d4ed8b2 100644 --- a/sdk/openapi.json +++ b/sdk/openapi.json @@ -2237,6 +2237,54 @@ } } } + }, + "/o/{id}/badge.svg": { + "get": { + "tags": [ + "Verification" + ], + "summary": "Embeddable status badge for an outcome", + "description": "Returns a small SVG badge (\"Provable.io | Verified · {id}\") showing the outcome's verification status: Verified, Committed, Seed revealed or Mismatch. Meant for a customer's own results or winners page, wrapped in a link to `/o/{id}`. Sets `Cross-Origin-Resource-Policy: cross-origin` and no cookies so it loads from any site. Responses are cached (5 minutes).", + "operationId": "getOutcomeBadge", + "security": [], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The `shortId` returned with the outcome (~10 alphanumeric characters).", + "example": "k7Qm2A9bXz", + "schema": { + "type": "string", + "minLength": 4, + "maxLength": 32, + "pattern": "^[A-Za-z0-9]+$" + } + } + ], + "responses": { + "200": { + "description": "SVG badge.", + "content": { + "image/svg+xml": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Unknown shortId: an SVG badge reading \"Draw not found\".", + "content": { + "image/svg+xml": { + "schema": { + "type": "string" + } + } + } + } + } + } } }, "components": { diff --git a/sdk/python/src/provableio/client.py b/sdk/python/src/provableio/client.py index 4debf95..88dbefe 100644 --- a/sdk/python/src/provableio/client.py +++ b/sdk/python/src/provableio/client.py @@ -225,6 +225,11 @@ def get_outcome_og_image(self, outcome_id: str, **options: Unpack[RequestOptions "getOutcomeOgImage", path_params={"id": outcome_id}, options=options, ) + def get_outcome_badge(self, outcome_id: str, **options: Unpack[RequestOptions]) -> ApiResult[models.GetOutcomeBadgeResponse]: + return self._operation( + "getOutcomeBadge", path_params={"id": outcome_id}, options=options, + ) + def stream_outcomes( self, query: models.StreamOutcomesParams, diff --git a/sdk/python/src/provableio/models.py b/sdk/python/src/provableio/models.py index c0df4f0..105f575 100644 --- a/sdk/python/src/provableio/models.py +++ b/sdk/python/src/provableio/models.py @@ -428,3 +428,8 @@ class GetOutcomeOgImageParams(TypedDict, total=False): GetOutcomeOgImageResponse = bytes +class GetOutcomeBadgeParams(TypedDict, total=False): + id: Required[str] + +GetOutcomeBadgeResponse = str + diff --git a/sdk/python/src/provableio/operations.py b/sdk/python/src/provableio/operations.py index 2935793..9f0b21a 100644 --- a/sdk/python/src/provableio/operations.py +++ b/sdk/python/src/provableio/operations.py @@ -1,5 +1,5 @@ """Generated operation-to-method map. Do not edit by hand.""" -OPERATION_METHODS = {'batchDraw': 'batch', 'getBytes': 'get_bytes', 'createCommit': 'create_commit', 'listSealedCommits': 'list_sealed_commits', 'rollDice': 'roll_dice', 'getFloats': 'get_floats', 'gaussian': 'gaussian', 'getHealth': 'get_health', 'getPublicMetrics': 'get_public_metrics', 'incrementCursor': 'increment_cursor', 'getInts': 'get_ints', 'listOutcomes': 'list_outcomes', 'listMerkleRoots': 'list_merkle_roots', 'getMerkleRoot': 'get_merkle_root', 'getMerkleProof': 'get_merkle_proof', 'getOutcome': 'get_outcome', 'pickItem': 'pick', 'revealCommit': 'reveal_commit', 'rotateServerSeed': 'rotate_server_seed', 'shuffleItems': 'shuffle', 'streamOutcomes': 'stream_outcomes', 'verifyServerHash': 'verify_server_hash', 'verifyShortId': 'verify_short_id', 'streamPublicDraws': 'stream_public_draws', 'getOutcomePermalink': 'get_outcome_permalink', 'getOutcomeOgImage': 'get_outcome_og_image'} +OPERATION_METHODS = {'batchDraw': 'batch', 'getBytes': 'get_bytes', 'createCommit': 'create_commit', 'listSealedCommits': 'list_sealed_commits', 'rollDice': 'roll_dice', 'getFloats': 'get_floats', 'gaussian': 'gaussian', 'getHealth': 'get_health', 'getPublicMetrics': 'get_public_metrics', 'incrementCursor': 'increment_cursor', 'getInts': 'get_ints', 'listOutcomes': 'list_outcomes', 'listMerkleRoots': 'list_merkle_roots', 'getMerkleRoot': 'get_merkle_root', 'getMerkleProof': 'get_merkle_proof', 'getOutcome': 'get_outcome', 'pickItem': 'pick', 'revealCommit': 'reveal_commit', 'rotateServerSeed': 'rotate_server_seed', 'shuffleItems': 'shuffle', 'streamOutcomes': 'stream_outcomes', 'verifyServerHash': 'verify_server_hash', 'verifyShortId': 'verify_short_id', 'streamPublicDraws': 'stream_public_draws', 'getOutcomePermalink': 'get_outcome_permalink', 'getOutcomeOgImage': 'get_outcome_og_image', 'getOutcomeBadge': 'get_outcome_badge'} -OPERATIONS = {'batchDraw': {'method': 'POST', 'path': '/api/batch', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': True}, 'getBytes': {'method': 'GET', 'path': '/api/bytes', 'query': ('clientSeed', 'count', 'encoding'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'createCommit': {'method': 'POST', 'path': '/api/commit', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': True}, 'listSealedCommits': {'method': 'GET', 'path': '/api/commits', 'query': ('label', 'limit'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'rollDice': {'method': 'GET', 'path': '/api/dice', 'query': ('clientSeed', 'notation'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'getFloats': {'method': 'GET', 'path': '/api/floats', 'query': ('clientSeed', 'count'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'gaussian': {'method': 'GET', 'path': '/api/gaussian', 'query': ('clientSeed', 'count', 'distribution', 'mean', 'stddev', 'lambda'), 'query_aliases': {'lambda_': 'lambda'}, 'path_params': (), 'has_body': False}, 'getHealth': {'method': 'GET', 'path': '/api/health', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'getPublicMetrics': {'method': 'GET', 'path': '/api/public-metrics', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'incrementCursor': {'method': 'GET', 'path': '/api/incrementCursor', 'query': ('clientSeed',), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'getInts': {'method': 'GET', 'path': '/api/ints', 'query': ('clientSeed', 'count', 'min', 'max', 'toolMeta'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'listOutcomes': {'method': 'GET', 'path': '/api/listOutcomes', 'query': ('clientSeed', 'limit', 'before'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'listMerkleRoots': {'method': 'GET', 'path': '/api/merkle', 'query': ('limit',), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'getMerkleRoot': {'method': 'GET', 'path': '/api/merkle/{date}', 'query': (), 'query_aliases': {}, 'path_params': ('date',), 'has_body': False}, 'getMerkleProof': {'method': 'GET', 'path': '/api/merkle/{date}/proof/{outcomeId}', 'query': (), 'query_aliases': {}, 'path_params': ('date', 'outcomeId'), 'has_body': False}, 'getOutcome': {'method': 'GET', 'path': '/api/outcome', 'query': ('clientSeed', 'cursor', 'nonce'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'pickItem': {'method': 'GET', 'path': '/api/pick', 'query': ('clientSeed', 'items', 'weights'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'revealCommit': {'method': 'POST', 'path': '/api/reveal', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': True}, 'rotateServerSeed': {'method': 'POST', 'path': '/api/rotate', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': True}, 'shuffleItems': {'method': 'GET', 'path': '/api/shuffle', 'query': ('clientSeed', 'items', 'toolMeta'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'streamOutcomes': {'method': 'GET', 'path': '/api/stream', 'query': ('clientSeed', 'endpoint', 'intervalMs', 'lastEventId'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'verifyServerHash': {'method': 'GET', 'path': '/api/verifyServerHash', 'query': ('clientSeed', 'serverHash'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'verifyShortId': {'method': 'GET', 'path': '/api/verifyShortId', 'query': ('shortId',), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'streamPublicDraws': {'method': 'GET', 'path': '/o/stream', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'getOutcomePermalink': {'method': 'GET', 'path': '/o/{id}', 'query': (), 'query_aliases': {}, 'path_params': ('id',), 'has_body': False}, 'getOutcomeOgImage': {'method': 'GET', 'path': '/o/{id}/og.png', 'query': (), 'query_aliases': {}, 'path_params': ('id',), 'has_body': False}} +OPERATIONS = {'batchDraw': {'method': 'POST', 'path': '/api/batch', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': True}, 'getBytes': {'method': 'GET', 'path': '/api/bytes', 'query': ('clientSeed', 'count', 'encoding'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'createCommit': {'method': 'POST', 'path': '/api/commit', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': True}, 'listSealedCommits': {'method': 'GET', 'path': '/api/commits', 'query': ('label', 'limit'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'rollDice': {'method': 'GET', 'path': '/api/dice', 'query': ('clientSeed', 'notation'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'getFloats': {'method': 'GET', 'path': '/api/floats', 'query': ('clientSeed', 'count'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'gaussian': {'method': 'GET', 'path': '/api/gaussian', 'query': ('clientSeed', 'count', 'distribution', 'mean', 'stddev', 'lambda'), 'query_aliases': {'lambda_': 'lambda'}, 'path_params': (), 'has_body': False}, 'getHealth': {'method': 'GET', 'path': '/api/health', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'getPublicMetrics': {'method': 'GET', 'path': '/api/public-metrics', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'incrementCursor': {'method': 'GET', 'path': '/api/incrementCursor', 'query': ('clientSeed',), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'getInts': {'method': 'GET', 'path': '/api/ints', 'query': ('clientSeed', 'count', 'min', 'max', 'toolMeta'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'listOutcomes': {'method': 'GET', 'path': '/api/listOutcomes', 'query': ('clientSeed', 'limit', 'before'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'listMerkleRoots': {'method': 'GET', 'path': '/api/merkle', 'query': ('limit',), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'getMerkleRoot': {'method': 'GET', 'path': '/api/merkle/{date}', 'query': (), 'query_aliases': {}, 'path_params': ('date',), 'has_body': False}, 'getMerkleProof': {'method': 'GET', 'path': '/api/merkle/{date}/proof/{outcomeId}', 'query': (), 'query_aliases': {}, 'path_params': ('date', 'outcomeId'), 'has_body': False}, 'getOutcome': {'method': 'GET', 'path': '/api/outcome', 'query': ('clientSeed', 'cursor', 'nonce'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'pickItem': {'method': 'GET', 'path': '/api/pick', 'query': ('clientSeed', 'items', 'weights'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'revealCommit': {'method': 'POST', 'path': '/api/reveal', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': True}, 'rotateServerSeed': {'method': 'POST', 'path': '/api/rotate', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': True}, 'shuffleItems': {'method': 'GET', 'path': '/api/shuffle', 'query': ('clientSeed', 'items', 'toolMeta'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'streamOutcomes': {'method': 'GET', 'path': '/api/stream', 'query': ('clientSeed', 'endpoint', 'intervalMs', 'lastEventId'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'verifyServerHash': {'method': 'GET', 'path': '/api/verifyServerHash', 'query': ('clientSeed', 'serverHash'), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'verifyShortId': {'method': 'GET', 'path': '/api/verifyShortId', 'query': ('shortId',), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'streamPublicDraws': {'method': 'GET', 'path': '/o/stream', 'query': (), 'query_aliases': {}, 'path_params': (), 'has_body': False}, 'getOutcomePermalink': {'method': 'GET', 'path': '/o/{id}', 'query': (), 'query_aliases': {}, 'path_params': ('id',), 'has_body': False}, 'getOutcomeOgImage': {'method': 'GET', 'path': '/o/{id}/og.png', 'query': (), 'query_aliases': {}, 'path_params': ('id',), 'has_body': False}, 'getOutcomeBadge': {'method': 'GET', 'path': '/o/{id}/badge.svg', 'query': (), 'query_aliases': {}, 'path_params': ('id',), 'has_body': False}} diff --git a/sdk/typescript/src/openapi-types.ts b/sdk/typescript/src/openapi-types.ts index 03765c4..915d7a2 100644 --- a/sdk/typescript/src/openapi-types.ts +++ b/sdk/typescript/src/openapi-types.ts @@ -552,6 +552,26 @@ export interface paths { patch?: never; trace?: never; }; + "/o/{id}/badge.svg": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Embeddable status badge for an outcome + * @description Returns a small SVG badge ("Provable.io | Verified · {id}") showing the outcome's verification status: Verified, Committed, Seed revealed or Mismatch. Meant for a customer's own results or winners page, wrapped in a link to `/o/{id}`. Sets `Cross-Origin-Resource-Policy: cross-origin` and no cookies so it loads from any site. Responses are cached (5 minutes). + */ + get: operations["getOutcomeBadge"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; } export type webhooks = Record; export interface components { @@ -2656,4 +2676,39 @@ export interface operations { }; }; }; + getOutcomeBadge: { + parameters: { + query?: never; + header?: never; + path: { + /** + * @description The `shortId` returned with the outcome (~10 alphanumeric characters). + * @example k7Qm2A9bXz + */ + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description SVG badge. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "image/svg+xml": string; + }; + }; + /** @description Unknown shortId: an SVG badge reading "Draw not found". */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "image/svg+xml": string; + }; + }; + }; + }; } diff --git a/sdk/typescript/test/client.test.mjs b/sdk/typescript/test/client.test.mjs index d93a8e2..47c6c62 100644 --- a/sdk/typescript/test/client.test.mjs +++ b/sdk/typescript/test/client.test.mjs @@ -114,7 +114,7 @@ test("every JSON operation in openapi.json has a client method", async () => { const { readFile } = await import("node:fs/promises"); const spec = JSON.parse(await readFile(new URL("../../openapi.json", import.meta.url), "utf8")); const src = await readFile(new URL("../src/index.ts", import.meta.url), "utf8"); - // og.png is an image for social cards, not an API call - const missing = Object.keys(spec.paths).filter((p) => !p.endsWith("/og.png") && !src.includes(`"${p}"`)); + // og.png and badge.svg are images, not API calls + const missing = Object.keys(spec.paths).filter((p) => !/\/(og\.png|badge\.svg)$/.test(p) && !src.includes(`"${p}"`)); assert.deepEqual(missing, []); });