export type GetApiReopenSeatsTicketsArgs = {uid?: string | undefined, trip_id?: number | undefined}; export type GetApiReopenSeatsTicketsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search tickets * * GET /reopen_seats/tickets */ export const getApiReopenSeatsTickets = async (args: GetApiReopenSeatsTicketsArgs, options?: GetApiReopenSeatsTicketsOptions) => { const {baseUrl = "http://api.gostarmartbus.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.uid != null) query.append("uid", String(args.uid)) if (args.trip_id != null) query.append("trip_id", String(args.trip_id)) const url = `${baseUrl.replace(/\/+$/, '')}/reopen_seats/tickets${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 };