export type GetApiApiV2StationsBrowseArgs = {limit?: number | undefined, cursor?: string | undefined, offset?: number | undefined, mount_status?: boolean | undefined}; export type GetApiApiV2StationsBrowseOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Browse all stations. Pass the 'nextCursor' of a response as the 'cursor' of the next request to walk through all the results. * * GET /api/v2/stations/browse */ export const getApiApiV2StationsBrowse = async (args: GetApiApiV2StationsBrowseArgs, options?: GetApiApiV2StationsBrowseOptions) => { const {baseUrl = "https://api.zeno.fm", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.limit != null) query.append("limit", String(args.limit)) if (args.cursor != null) query.append("cursor", String(args.cursor)) if (args.offset != null) query.append("offset", String(args.offset)) if (args.mount_status != null) query.append("mount_status", String(args.mount_status)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/stations/browse${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() };