export type Tag = {key?: string | undefined, type?: string | undefined, value?: string | undefined}; export type MessageTemplate = {createTime?: number | undefined, createdBy?: string | undefined, description?: string | undefined, integrations?: Array | undefined, name?: string | undefined, ownerApp?: string | undefined, responseFormat?: string | undefined, stopWords?: Array | undefined, tags?: Array | undefined, temperature?: number | undefined, template?: string | undefined, topP?: number | undefined, updateTime?: number | undefined, updatedBy?: string | undefined, variables?: Array | undefined, version?: number | undefined}; export type CreateApiApiPromptsArgs = {body: Array}; export type CreateApiApiPromptsOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create message templates in bulk * * POST /api/prompts/ */ export const createApiApiPrompts = async (args: CreateApiApiPromptsArgs, options?: CreateApiApiPromptsOptions) => { 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 (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/prompts/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };