export type LodgifyMessagingLegacyPublicApiModelsBookingThreadMessageTypeDto = 'Owner' | 'Comment' | 'Renter'; export type LodgifyMessagingLegacyPublicApiModelsCreateBookingMessageDto = {subject?: (string | null) | undefined, message?: (string | null) | undefined, type?: LodgifyMessagingLegacyPublicApiModelsBookingThreadMessageTypeDto | undefined, send_notification?: boolean | undefined, message_id?: string | undefined}; export type CreateApiV1ReservationEnquiryIdMessagesArgs = {id: number, body: Array}; export type CreateApiV1ReservationEnquiryIdMessagesOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Adds messages to an enquiry * * POST /v1/reservation/enquiry/{id}/messages */ export const createApiV1ReservationEnquiryIdMessages = async (args: CreateApiV1ReservationEnquiryIdMessagesArgs, options?: CreateApiV1ReservationEnquiryIdMessagesOptions) => { 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/enquiry/${encodeURIComponent(String(args.id))}/messages${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };