// Auto-generated by `pnpm run gen:examples` — do not edit by hand. // Source: tests/recordings/_*/_*/recording.har // // Each entry is the green-path payload for one endpoint, mined from a real // integration-test recording. `attachExamples` walks the provider tree and // hangs the matching entry off each endpoint function as `.example`. export interface EndpointExample { source: string; payload: unknown; /** Canonical cost tier of this endpoint (see @apicity/cost). */ tier: "cheap" | "expensive" | "prohibitive"; /** Whether an example runner may execute this by default (cheap only). */ runByDefault: boolean; } const EXAMPLES: Record = { "GET v1.accounts.captchaStats": { "source": "google-flow/contracts", "payload": { "date": "2026-06-25", "limit": 10, "provider": "CapSolver", "anonymized": true }, "tier": "prohibitive", "runByDefault": false }, "GET v1.characters": { "source": "google-flow/contracts", "payload": { "email": "user@example.com" }, "tier": "prohibitive", "runByDefault": false }, "GET v1.jobs": { "source": "google-flow/contracts", "payload": { "options": "history" }, "tier": "prohibitive", "runByDefault": false }, "GET v1.voices": { "source": "google-flow/contracts", "payload": { "email": "user@example.com", "source": "user" }, "tier": "prohibitive", "runByDefault": false }, "POST v1.accounts": { "source": "google-flow/contracts", "payload": { "cookies": "SID=fixture;" }, "tier": "prohibitive", "runByDefault": false }, "POST v1.accounts.captchaProviders": { "source": "google-flow/contracts", "payload": { "CapSolver": "provider-key" }, "tier": "prohibitive", "runByDefault": false }, "POST v1.characters": { "source": "google-flow/contracts", "payload": { "displayName": "Ari", "imageReference_1": "media-1" }, "tier": "prohibitive", "runByDefault": false }, "POST v1.images": { "source": "google-flow/contracts", "payload": { "prompt": "A clean product photo", "model": "nano-banana-pro", "aspectRatio": "1:1", "count": 1, "captchaRetry": 5 }, "tier": "prohibitive", "runByDefault": false }, "POST v1.images.upscale": { "source": "google-flow/contracts", "payload": { "mediaGenerationId": "image-1", "resolution": "2k" }, "tier": "prohibitive", "runByDefault": false }, "POST v1.videos": { "source": "google-flow/omni-1-2-t2v", "payload": { "prompt": "A red paper boat drifts slowly across a still pond.", "model": "omni-flash-1.2", "duration": 3, "resolution": "360p" }, "tier": "prohibitive", "runByDefault": false }, "POST v1.videos.concatenate": { "source": "google-flow/contracts", "payload": { "media": [ { "mediaGenerationId": "video-1", "trimStart": 1 }, { "mediaGenerationId": "video-2", "trimEnd": 1 } ] }, "tier": "prohibitive", "runByDefault": false }, "POST v1.videos.extend": { "source": "google-flow/contracts", "payload": { "mediaGenerationId": "video-1", "prompt": "Continue the motion", "captchaOrder": "AntiCaptcha,CapSolver" }, "tier": "prohibitive", "runByDefault": false }, "POST v1.videos.gif": { "source": "google-flow/contracts", "payload": { "mediaGenerationId": "video-1" }, "tier": "prohibitive", "runByDefault": false }, "POST v1.videos.upscale": { "source": "google-flow/contracts", "payload": { "mediaGenerationId": "video-1", "resolution": "1080p" }, "tier": "prohibitive", "runByDefault": false }, "POST v1.voices": { "source": "google-flow/contracts", "payload": { "email": "user@example.com", "voice": "Aoede", "displayName": "Narrator", "dialog": "Hello there", "voicePerformance": "Warm and clear" }, "tier": "prohibitive", "runByDefault": false } }; export default EXAMPLES; // Walks each " " key onto the provider's tree. Tries the // standard `provider..` shape first, then a few fallbacks // to cover providers with non-standard layouts (fal's `.run.` namespace, // kie's sub-providers, `free`'s flat root). Returns the same provider for // drop-in use as `return attachExamples({ ... });`. export function attachExamples(provider: T): T { const root = provider as Record; const HTTP_KEYS = new Set(["post", "get", "put", "delete", "patch", "head"]); for (const [key, example] of Object.entries(EXAMPLES)) { const sp = key.indexOf(" "); if (sp < 0) continue; const method = key.slice(0, sp).toLowerCase(); const segs = key.slice(sp + 1).split("."); const candidates: Array = [ root[method], (root[method] as Record | undefined)?.run, root, ]; if (segs.length > 1) { const sub = root[segs[0]]; if (sub && typeof sub === "object") { const subMethod = (sub as Record)[method]; if (subMethod) candidates.push({ __nested: subMethod, __segs: segs.slice(1) }); } } let attached = false; for (const c of candidates) { const fn = walkToFn(c, segs); if (fn) { Object.assign(fn, { example }); attached = true; break; } } if (attached) continue; for (const k of Object.keys(root)) { if (HTTP_KEYS.has(k)) continue; if (!segs.includes(k)) continue; const sub = root[k]; if (!sub || typeof sub !== "object") continue; const subMethod = (sub as Record)[method]; if (!subMethod) continue; const fn = walkToFn(subMethod, segs); if (fn) { Object.assign(fn, { example }); break; } } } return provider; } function walkToFn(start: unknown, segs: string[]): ((...args: unknown[]) => unknown) | null { if (start && typeof start === "object" && "__nested" in (start as object)) { const wrapper = start as { __nested: unknown; __segs: string[] }; return walkToFn(wrapper.__nested, wrapper.__segs); } let cur: unknown = start; for (const seg of segs) { if (cur === null || cur === undefined) return null; const t = typeof cur; if (t !== "object" && t !== "function") return null; cur = (cur as Record)[seg]; } return typeof cur === "function" ? (cur as (...args: unknown[]) => unknown) : null; }