export type ContactUpdateRequest = {type?: string | undefined, region?: string | undefined, setData: {[key: string]: Record}, removeData: {[key: string]: Record}}; export type PatchApiContactTenantLocatorContactsLocatorArgs = {tenantLocator: string, locator: unknown, body: ContactUpdateRequest}; export type PatchApiContactTenantLocatorContactsLocatorOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * PATCH /contact/{tenantLocator}/contacts/{locator} */ export const patchApiContactTenantLocatorContactsLocator = async (args: PatchApiContactTenantLocatorContactsLocatorArgs, options: PatchApiContactTenantLocatorContactsLocatorOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/contact/${encodeURIComponent(String(args.tenantLocator))}/contacts/${encodeURIComponent(String(args.locator))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 res.blob() };