export type UpdateApiV1GuestsGuestIdArgs = {guest_id: string, tags: string, address_info: Record, preferences: Record, referral: Record, primary_employee: Record, body: {id?: string | undefined, code: string, center_id: string, center_name?: string | undefined, personal_info: {user_name?: string | undefined, first_name?: string | undefined, last_name?: string | undefined, middle_name?: string | undefined, email?: string | undefined, mobile_phone?: Record | undefined, country_code?: string | undefined, number?: string | undefined}, preferred_service_id?: string | undefined, created_date?: string | undefined, can_edit_personal_info?: boolean | undefined, is_virtual_guest?: boolean | undefined, guest_type?: string | undefined, is_guest_custom_form_filled?: boolean | undefined, login_info?: ({password?: string | undefined}) | undefined, expand?: Array | undefined, tin_number?: string | undefined, registration_type?: number | undefined, registration_id?: string | undefined, account_name?: string | undefined, legal_name?: string | undefined}}; export type UpdateApiV1GuestsGuestIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update details of a guest * * PUT /v1/guests/{guest_id} */ export const updateApiV1GuestsGuestId = async (args: UpdateApiV1GuestsGuestIdArgs, options?: UpdateApiV1GuestsGuestIdOptions) => { const {baseUrl = "https://api.zenoti.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args.tags != null) query.append("tags", String(args.tags)) if (args.address_info != null) query.append("address_info", JSON.stringify(args.address_info)) if (args.preferences != null) query.append("preferences", JSON.stringify(args.preferences)) if (args.referral != null) query.append("referral", JSON.stringify(args.referral)) if (args.primary_employee != null) query.append("primary_employee", JSON.stringify(args.primary_employee)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/guests/${encodeURIComponent(String(args.guest_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 (await res.json()) as unknown };