export type CreateApiV1FeedbackArgs = {Authorization?: string | undefined, body: {message: string, url: string, sessionId?: string | undefined, orgId?: string | undefined}}; export type CreateApiV1FeedbackOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Sends feedback from the signed-in user to the Tessl team. Responds 503 when this instance is not set up to receive feedback. * * POST /v1/feedback */ export const createApiV1Feedback = async (args: CreateApiV1FeedbackArgs, options?: CreateApiV1FeedbackOptions) => { const {baseUrl = "https://api.tessl.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/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 };