export type EmergencyContactAddress = {Address1?: (string | null) | undefined, Address2?: (string | null) | undefined, Address3?: (string | null) | undefined, Address4?: (string | null) | undefined, PostCode?: (string | null) | undefined}; export type Ownership = 'Personal' | 'Organization'; export type PhoneType = 'Mobile' | 'Landline'; export type EmergencyContactPhone = {Ownership?: Ownership | undefined, Type?: PhoneType | undefined, Value?: (string | null) | undefined}; export type UpdateEmergencyContactCommand = {Name?: (string | null) | undefined, Relation?: (string | null) | undefined, Address?: EmergencyContactAddress | undefined, Phones?: (Array | null) | undefined, Primary?: boolean | undefined}; export type UpdateApiEmergencycontactsIdArgs = {id: string, body: UpdateEmergencyContactCommand}; export type UpdateApiEmergencycontactsIdOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update an Employee Emergency Contact referenced by ID. * * PUT /emergencycontacts/{id} */ export const updateApiEmergencycontactsId = async (args: UpdateApiEmergencycontactsIdArgs, options?: UpdateApiEmergencycontactsIdOptions) => { const {baseUrl = "https://api.iris.co.uk/hr/v2", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/emergencycontacts/${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 };