Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions sdk/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
5 changes: 5 additions & 0 deletions sdk/python/src/provableio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions sdk/python/src/provableio/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,3 +428,8 @@ class GetOutcomeOgImageParams(TypedDict, total=False):

GetOutcomeOgImageResponse = bytes

class GetOutcomeBadgeParams(TypedDict, total=False):
id: Required[str]

GetOutcomeBadgeResponse = str

4 changes: 2 additions & 2 deletions sdk/python/src/provableio/operations.py
Original file line number Diff line number Diff line change
@@ -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}}
55 changes: 55 additions & 0 deletions sdk/typescript/src/openapi-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, never>;
export interface components {
Expand Down Expand Up @@ -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;
};
};
};
};
}
4 changes: 2 additions & 2 deletions sdk/typescript/test/client.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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, []);
});
Loading