export type UpdateApiApiPromptsNameArgs = {name: string, version?: number | undefined, description: string, models?: Array | undefined, body: string}; export type UpdateApiApiPromptsNameOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a template * * PUT /api/prompts/{name} */ export const updateApiApiPromptsName = async (args: UpdateApiApiPromptsNameArgs, options?: UpdateApiApiPromptsNameOptions) => { const {baseUrl = "https://developer.orkescloud.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.version != null) query.append("version", String(args.version)) if (args.description != null) query.append("description", String(args.description)) for (const item of args.models ?? []) query.append("models", String(item)) if (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/prompts/${encodeURIComponent(String(args.name))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };