export type CreateApiV1TicketsIdSuggestionsRegenerateArgs = {id: number}; export type CreateApiV1TicketsIdSuggestionsRegenerateOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Queue an on-demand regeneration of the ticket's AI suggestion (IDT-2012). Ticket * analog of `POST /v1/chat/rooms/{roomId}/suggestions/regenerate`: throttled by a * per-ticket 30s Redis SETNX cooldown so agents (across pods) cannot flood the copilot * side. The fresh suggestion reaches the dashboard through the normal * `newTicketSuggestion` push. Returns the raw response object — NOT wrapped in * `ApiResponse` — mirroring the chat endpoint: * `{queued:true}` or `{queued:false, cooldownSeconds:N}`. * * POST /v1/tickets/{id}/suggestions/regenerate * * Also accepts auth: API Key */ export const createApiV1TicketsIdSuggestionsRegenerate = async (args: CreateApiV1TicketsIdSuggestionsRegenerateArgs, options: CreateApiV1TicketsIdSuggestionsRegenerateOptions) => { 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/tickets/${encodeURIComponent(String(args.id))}/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 };