export type GetApiV1PublicCalendarIdIcsArgs = {id: string}; export type GetApiV1PublicCalendarIdIcsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get your calendar url * * GET /v1/public/calendar/{id}.ics */ export const getApiV1PublicCalendarIdIcs = async (args: GetApiV1PublicCalendarIdIcsArgs, options?: GetApiV1PublicCalendarIdIcsOptions) => { const {baseUrl = "https://api.evolia.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/v1/public/calendar/${encodeURIComponent(String(args.id))}.ics${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 undefined };