export type CreateApiAgentThreadsIdArchiveArgs = {id: string}; export type CreateApiAgentThreadsIdArchiveOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Archive agent thread * * POST /agent/threads/{id}/archive */ export const createApiAgentThreadsIdArchive = async (args: CreateApiAgentThreadsIdArchiveArgs, options?: CreateApiAgentThreadsIdArchiveOptions) => { const {baseUrl = "http://localhost:3000/api/openapi", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set("x-api-key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/agent/threads/${encodeURIComponent(String(args.id))}/archive${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };