export type UpdateApiQueuesLoansIdArgs = {id: number, body: BodyInit}; export type UpdateApiQueuesLoansIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a queue loan * * PUT /queues/loans/{id} */ export const updateApiQueuesLoansId = async (args: UpdateApiQueuesLoansIdArgs, options?: UpdateApiQueuesLoansIdOptions) => { const {baseUrl = "https://www.rcac.purdue.edu/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/queues/loans/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };