export type GetApiApiV2StationsStationKeyArgs = {stationKey: string}; export type GetApiApiV2StationsStationKeyOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get station * * GET /api/v2/stations/{stationKey} */ export const getApiApiV2StationsStationKey = async (args: GetApiApiV2StationsStationKeyArgs, options?: GetApiApiV2StationsStationKeyOptions) => { const {baseUrl = "https://api.zeno.fm", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/stations/${encodeURIComponent(String(args.stationKey))}${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() };