export type GetApiTranslateBrailleHtmlArgs = {text: unknown};
export type GetApiTranslateBrailleHtmlOptions = {baseUrl?: string | undefined, XFuntranslationsApiSecret?: string | undefined, fetch?: typeof fetch | undefined};
/**
* Translate from English to Braille Image characters. This is probably what you want to use if you are displaying braille in a browser.
*
* GET /translate/braille/html
*/
export const getApiTranslateBrailleHtml = async (args: GetApiTranslateBrailleHtmlArgs, options?: GetApiTranslateBrailleHtmlOptions) => {
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/html${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
};