export type GetApiOsaFileextensionsOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get all supported Open Source file extensions * * GET /osa/fileextensions */ export const getApiOsaFileextensions = async (options?: GetApiOsaFileextensionsOptions) => { const {baseUrl = "https://desktop-rmvpboc/cxrestapi/help", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain;v=1.0") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/osa/fileextensions${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 res.text() };