export type AgentPatchMultiple = {data: Array<{id: number, type: 'agent', attributes: {agentName?: string | undefined, cmdPars?: string | undefined, cpuOnly?: boolean | undefined, ignoreErrors?: (0 | 1 | 2) | undefined, isActive?: boolean | undefined, isTrusted?: boolean | undefined, os?: (0 | 1 | 2) | undefined, uid?: string | undefined, userId?: (number | null) | undefined}}>}; export type PatchApiApiV2UiAgentsArgs = {body: AgentPatchMultiple}; export type PatchApiApiV2UiAgentsOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Agents * * PATCH /api/v2/ui/agents */ export const patchApiApiV2UiAgents = async (args: PatchApiApiV2UiAgentsArgs, options: PatchApiApiV2UiAgentsOptions) => { 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/agents${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 };