export type LodgifyApiPublicReservationsModelsV1GuestNameDto = {first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, full_name?: (string | null) | undefined}; export type LodgifyApiPublicReservationsModelsV1GuestDto = {id?: (string | null) | undefined, country_name?: (string | null) | undefined, guest_name: LodgifyApiPublicReservationsModelsV1GuestNameDto, name?: (string | null) | undefined, external_id?: (string | null) | undefined, email?: (string | null) | undefined, phone?: (string | null) | undefined, locale?: (string | null) | undefined, street_address1?: (string | null) | undefined, street_address2?: (string | null) | undefined, city?: (string | null) | undefined, country_code?: (string | null) | undefined, postal_code?: (string | null) | undefined, state?: (string | null) | undefined}; export type LodgifyApiPublicReservationsModelsV12GuestBreakdownDto = {adults?: number | undefined, children?: number | undefined, infants?: number | undefined, pets?: number | undefined}; export type LodgifyApiPublicReservationsModelsV1BookingRoomTypeDto = {name?: (string | null) | undefined, room_type_id?: number | undefined, guest_breakdown: LodgifyApiPublicReservationsModelsV12GuestBreakdownDto, people?: number | undefined, key_code?: (string | null) | undefined}; export type LodgifyApiPublicReservationsModelsV1CurrencyDto = {id?: number | undefined, code?: (string | null) | undefined, name?: (string | null) | undefined, euro_forex?: number | undefined, symbol?: (string | null) | undefined}; export type LodgifyApiPublicReservationsModelsV1BookingThreadMessageTypeDto = 'Owner' | 'Comment' | 'Renter'; export type LodgifyApiPublicReservationsModelsV1BookingThreadMessageDto = {subject?: (string | null) | undefined, message?: (string | null) | undefined, type?: LodgifyApiPublicReservationsModelsV1BookingThreadMessageTypeDto | undefined, is_replied?: boolean | undefined, created_at?: string | undefined}; export type LodgifyApiPublicReservationsModelsV1BookingDetailsDto = {id?: number | undefined, type?: (string | null) | undefined, booking_type?: (string | null) | undefined, status?: (string | null) | undefined, source?: (string | null) | undefined, source_text?: (string | null) | undefined, guest?: LodgifyApiPublicReservationsModelsV1GuestDto | undefined, arrival?: (string | null) | undefined, departure?: (string | null) | undefined, people?: (number | null) | undefined, property_id?: (number | null) | undefined, property_name?: (string | null) | undefined, rooms?: (Array | null) | undefined, created_at?: string | undefined, is_replied?: boolean | undefined, updated_at?: string | undefined, is_deleted?: boolean | undefined, date_deleted?: (string | null) | undefined, total_amount?: (number | null) | undefined, total_paid?: number | undefined, amount_to_pay?: (number | null) | undefined, thread_uid?: string | undefined, currency?: LodgifyApiPublicReservationsModelsV1CurrencyDto | undefined, note?: (string | null) | undefined, messages?: (Array | null) | undefined, payment_type?: (string | null) | undefined, payment_address?: (string | null) | undefined, payment_website_id?: (number | null) | undefined}; export type UpdateApiV1ReservationBookingIdArgs = {id: number, body: LodgifyApiPublicReservationsModelsV1BookingDetailsDto}; export type UpdateApiV1ReservationBookingIdOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates a booking * * PUT /v1/reservation/booking/{id} */ export const updateApiV1ReservationBookingId = async (args: UpdateApiV1ReservationBookingIdArgs, options?: UpdateApiV1ReservationBookingIdOptions) => { const {baseUrl = "https://api.lodgify.com", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKey !== undefined) headers.set("X-ApiKey", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/reservation/booking/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };