export type TaskPatchMultiple = {data: Array<{id: number, type: 'task', attributes: {attackCmd?: string | undefined, chunkTime?: number | undefined, color?: (string | null) | undefined, isArchived?: boolean | undefined, isCpuTask?: boolean | undefined, isSmall?: boolean | undefined, maxAgents?: number | undefined, notes?: string | undefined, preprocessorCommand?: string | undefined, priority?: number | undefined, statusTimer?: number | undefined, taskName?: string | undefined}}>}; export type PatchApiApiV2UiTasksArgs = {body: TaskPatchMultiple}; export type PatchApiApiV2UiTasksOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Tasks * * PATCH /api/v2/ui/tasks */ export const patchApiApiV2UiTasks = async (args: PatchApiApiV2UiTasksArgs, options: PatchApiApiV2UiTasksOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/vnd.api+json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/ui/tasks${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };