export type CreateApiApiAgentExecutionsPruneArgs = {olderThanDays?: number | undefined, archiveTasks?: boolean | undefined}; export type CreateApiApiAgentExecutionsPruneOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /api/agent/executions/prune */ export const createApiApiAgentExecutionsPrune = async (args: CreateApiApiAgentExecutionsPruneArgs, options?: CreateApiApiAgentExecutionsPruneOptions) => { const {baseUrl = "https://developer.orkescloud.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.olderThanDays != null) query.append("olderThanDays", String(args.olderThanDays)) if (args.archiveTasks != null) query.append("archiveTasks", String(args.archiveTasks)) if (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/agent/executions/prune${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 res.blob() };