export type SuggestionFeedbackRequestDto = {rating?: (string | null) | undefined}; export type CreateApiV1TicketsIdSuggestionsSuggestionIdFeedbackArgs = {id: number, suggestionId: number, body: SuggestionFeedbackRequestDto}; export type CreateApiV1TicketsIdSuggestionsSuggestionIdFeedbackOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Ticket analog of `POST /v1/chat/rooms/{roomId}/suggestions/{suggestionId}/feedback` — * queues the current agent's approval (👍) or disapproval (👎) of one AI suggestion. * `rating` is `up` | `down` | `none` (none withdraws). * * POST /v1/tickets/{id}/suggestions/{suggestionId}/feedback * * Also accepts auth: API Key */ export const createApiV1TicketsIdSuggestionsSuggestionIdFeedback = async (args: CreateApiV1TicketsIdSuggestionsSuggestionIdFeedbackArgs, options: CreateApiV1TicketsIdSuggestionsSuggestionIdFeedbackOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/tickets/${encodeURIComponent(String(args.id))}/suggestions/${encodeURIComponent(String(args.suggestionId))}/feedback${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };