export type GetApiTranslateBrailleDotsArgs = {text: unknown}; export type GetApiTranslateBrailleDotsOptions = {baseUrl?: string | undefined, XFuntranslationsApiSecret?: string | undefined, fetch?: typeof fetch | undefined}; /** * Use this to see which dots are enabled for each Braille letters. This is highly educational (to see which dots are enabled) and can potentially drive a non braille display which works on individual dots. * * GET /translate/braille/dots */ export const getApiTranslateBrailleDots = async (args: GetApiTranslateBrailleDotsArgs, options?: GetApiTranslateBrailleDotsOptions) => { const {baseUrl = "https://api.funtranslations.com", fetch: fetchFn = fetch, XFuntranslationsApiSecret} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.text != null) query.append("text", String(args.text)) if (XFuntranslationsApiSecret !== undefined) headers.set("X-Funtranslations-Api-Secret", XFuntranslationsApiSecret) const url = `${baseUrl.replace(/\/+$/, '')}/translate/braille/dots${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return (await res.json()) as unknown };