export type ContactEditModel = {FirstName: string, LastName: string, EmailAddress?: string | undefined, Description?: string | undefined, CultureName?: string | undefined, DefaultVehicleId?: number | undefined}; export type UpdateApiV1ResourceownerContactsContactIdArgs = {contactId: number, body: ContactEditModel}; export type UpdateApiV1ResourceownerContactsContactIdOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates the given contact id * * PUT /v1/resourceowner/contacts/{contactId} */ export const updateApiV1ResourceownerContactsContactId = async (args: UpdateApiV1ResourceownerContactsContactIdArgs, options: UpdateApiV1ResourceownerContactsContactIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/resourceowner/contacts/${encodeURIComponent(String(args.contactId))}${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 };