export type GetApiSeatTransferArgs = {from_trip_id: number, to_trip_id?: number | undefined}; export type GetApiSeatTransferOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Seat Transfer Layout * * GET /seat_transfer */ export const getApiSeatTransfer = async (args: GetApiSeatTransferArgs, options?: GetApiSeatTransferOptions) => { const {baseUrl = "http://api.gostarmartbus.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.from_trip_id != null) query.append("from_trip_id", String(args.from_trip_id)) if (args.to_trip_id != null) query.append("to_trip_id", String(args.to_trip_id)) const url = `${baseUrl.replace(/\/+$/, '')}/seat_transfer${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 };