export type GetApiDeparturePlansSearchDepartureNotesArgs = {station_id: number}; export type GetApiDeparturePlansSearchDepartureNotesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search last available departure plan notes * * GET /departure_plans/search_departure_notes */ export const getApiDeparturePlansSearchDepartureNotes = async (args: GetApiDeparturePlansSearchDepartureNotesArgs, options?: GetApiDeparturePlansSearchDepartureNotesOptions) => { const {baseUrl = "http://api.gostarmartbus.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.station_id != null) query.append("station_id", String(args.station_id)) const url = `${baseUrl.replace(/\/+$/, '')}/departure_plans/search_departure_notes${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 };