export type ReservationDetails = {status: string, capacity: number, areaId?: number | undefined, dateTime?: string | undefined, reservationTags?: Array | undefined, extraInfo?: string | undefined}; export type UpdateReservationData = {reservation: ReservationDetails}; export type PatchApiV1ReservationsReservationIdArgs = {reservationId: string, body: UpdateReservationData}; export type PatchApiV1ReservationsReservationIdOptions = {baseUrl: string, APITOKEN?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update reservation by id * * PATCH /v1/reservations/{reservationId} */ export const patchApiV1ReservationsReservationId = async (args: PatchApiV1ReservationsReservationIdArgs, options: PatchApiV1ReservationsReservationIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, APITOKEN} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APITOKEN !== undefined) headers.set("X-Quandoo-AuthToken", APITOKEN) const url = `${baseUrl.replace(/\/+$/, '')}/v1/reservations/${encodeURIComponent(String(args.reservationId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };