export type GetApiApiCalendarHolidaysArgs = {api_key: string, country?: string | undefined, subdiv?: string | undefined, currency?: string | undefined, year?: number | undefined, format?: ('json' | 'xml') | undefined, callback?: string | undefined}; export type GetApiApiCalendarHolidaysOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Public holidays for a country (optionally a subdivision/state) or a currency's settlement calendar in a given year. Available on the FREE tier (counts against the daily request quota). Holiday names are in English where the rule set provides it. Reference only. * * GET /api/calendar/holidays */ export const getApiApiCalendarHolidays = async (args: GetApiApiCalendarHolidaysArgs, options: GetApiApiCalendarHolidaysOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "gb_england_2026") if (args.api_key != null) query.append("api_key", String(args.api_key)) if (args.country != null) query.append("country", String(args.country)) if (args.subdiv != null) query.append("subdiv", String(args.subdiv)) if (args.currency != null) query.append("currency", String(args.currency)) if (args.year != null) query.append("year", String(args.year)) if (args.format != null) query.append("format", String(args.format)) if (args.callback != null) query.append("callback", String(args.callback)) const url = `${baseUrl.replace(/\/+$/, '')}/api/calendar/holidays${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.blob() };