export type UpdateApiV1GuestsGuestIdAccountsAccountIdBillingAddressArgs = {guest_id: string, account_id: string, body: {center_id?: string | undefined, processor_id?: string | undefined, billing_address?: Record | undefined}}; export type UpdateApiV1GuestsGuestIdAccountsAccountIdBillingAddressOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update billing address from the guest profile * * PUT /v1/guests/{guest_id}/accounts/{account_id}/billing_address */ export const updateApiV1GuestsGuestIdAccountsAccountIdBillingAddress = async (args: UpdateApiV1GuestsGuestIdAccountsAccountIdBillingAddressArgs, options?: UpdateApiV1GuestsGuestIdAccountsAccountIdBillingAddressOptions) => { 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") const url = `${baseUrl.replace(/\/+$/, '')}/v1/guests/${encodeURIComponent(String(args.guest_id))}/accounts/${encodeURIComponent(String(args.account_id))}/billing_address${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 };