export type UpdateApiV1ReservationBookingIdDeclineArgs = {id: number}; export type UpdateApiV1ReservationBookingIdDeclineOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Sets a booking as declined * * PUT /v1/reservation/booking/{id}/decline */ export const updateApiV1ReservationBookingIdDecline = async (args: UpdateApiV1ReservationBookingIdDeclineArgs, options?: UpdateApiV1ReservationBookingIdDeclineOptions) => { const {baseUrl = "https://api.lodgify.com", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKey !== undefined) headers.set("X-ApiKey", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/reservation/booking/${encodeURIComponent(String(args.id))}/decline${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };