export type GetApiRadiodnsSpi31IdFqdnSidDatePIXmlOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get the program information document. * * GET /radiodns/spi/3.1/id/{fqdn}/{sid}/{date}_PI.xml */ export const getApiRadiodnsSpi31IdFqdnSidDatePIXml = async (options: GetApiRadiodnsSpi31IdFqdnSidDatePIXmlOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/xml") const url = `${baseUrl.replace(/\/+$/, '')}/radiodns/spi/3.1/id/${encodeURIComponent(String(args.fqdn))}/${encodeURIComponent(String(args.sid))}/${encodeURIComponent(String(args.date))}_PI.xml${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() };