/** * SaaS Prompt OTA Methods — Mixin * * Installs prompt OTA methods onto SaaSClient.prototype. * Uses the same mixin pattern as gateway-api.ts. */ import type { PromptCheckResult, PromptTemplateInfo, PromptVersionInfo, PaginatedResponse, } from './saas-types'; export function installPromptMethods(ClientClass: { prototype: any }): void { const proto = ClientClass.prototype; /** Check for prompt updates (OTA) */ proto.checkPromptUpdates = async function (this: { request(method: string, path: string, body?: unknown): Promise }, deviceId: string, currentVersions: Record): Promise { return this.request('POST', '/api/v1/prompts/check', { device_id: deviceId, versions: currentVersions, }); }; /** List all prompt templates */ proto.listPrompts = async function (this: { request(method: string, path: string, body?: unknown): Promise }, params?: { category?: string; source?: string; status?: string; page?: number; page_size?: number }): Promise> { const qs = params ? '?' + new URLSearchParams(params as Record).toString() : ''; return this.request>('GET', `/api/v1/prompts${qs}`); }; /** Get prompt template by name */ proto.getPrompt = async function (this: { request(method: string, path: string, body?: unknown): Promise }, name: string): Promise { return this.request('GET', `/api/v1/prompts/${encodeURIComponent(name)}`); }; /** List prompt versions */ proto.listPromptVersions = async function (this: { request(method: string, path: string, body?: unknown): Promise }, name: string): Promise { return this.request('GET', `/api/v1/prompts/${encodeURIComponent(name)}/versions`); }; /** Get specific prompt version */ proto.getPromptVersion = async function (this: { request(method: string, path: string, body?: unknown): Promise }, name: string, version: number): Promise { return this.request('GET', `/api/v1/prompts/${encodeURIComponent(name)}/versions/${version}`); }; }