export type JToken = Array; export type UpdateApiApiV1AccountsAccountIdAddressesV2AccountAddressIdContactPersonArgs = {accountId: number, accountAddressId: number, body: {[key: string]: JToken}}; export type UpdateApiApiV1AccountsAccountIdAddressesV2AccountAddressIdContactPersonOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update the contact person stored on an account-address link. * Statements print this value as the c/o line. * * PUT /api/v1/Accounts/{accountId}/AddressesV2/{accountAddressId}/ContactPerson */ export const updateApiApiV1AccountsAccountIdAddressesV2AccountAddressIdContactPerson = async (args: UpdateApiApiV1AccountsAccountIdAddressesV2AccountAddressIdContactPersonArgs, options: UpdateApiApiV1AccountsAccountIdAddressesV2AccountAddressIdContactPersonOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/Accounts/${encodeURIComponent(String(args.accountId))}/AddressesV2/${encodeURIComponent(String(args.accountAddressId))}/ContactPerson${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 };