export type GetApiApiExportPropertyHistoryOptions = {baseUrl: string, AuthenticationToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Exports CSV formatted property history data * * GET /api/export/property/history * * Also accepts auth: DEPRECATED - API Key, API Key, Basic Auth */ export const getApiApiExportPropertyHistory = async (options: GetApiApiExportPropertyHistoryOptions) => { const {baseUrl, fetch: fetchFn = fetch, AuthenticationToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (AuthenticationToken !== undefined) headers.set("X-PL-AUTH", AuthenticationToken) const url = `${baseUrl.replace(/\/+$/, '')}/api/export/property/history${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() };