export type CreateApiV1ChatRoomsRoomIdSuggestionsRegenerateArgs = {roomId: number}; export type CreateApiV1ChatRoomsRoomIdSuggestionsRegenerateOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Queue an on-demand regeneration of the room's AI suggestion. Throttled by a * per-room 30s Redis SETNX cooldown so agents (across pods) cannot flood the * copilot side. Progress reaches the dashboard through the normal * `copilotStreamEvent` pushes. Returns the raw response object — NOT wrapped * in `ApiResponse` — to mirror the ticket summary refresh endpoint: * `{queued:true}` or `{queued:false, cooldownSeconds:N}`. * * POST /v1/chat/rooms/{roomId}/suggestions/regenerate * * Also accepts auth: API Key */ export const createApiV1ChatRoomsRoomIdSuggestionsRegenerate = async (args: CreateApiV1ChatRoomsRoomIdSuggestionsRegenerateArgs, options: CreateApiV1ChatRoomsRoomIdSuggestionsRegenerateOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/chat/rooms/${encodeURIComponent(String(args.roomId))}/suggestions/regenerate${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 };