export type Address = string; export type PostalCode = string; export type City = string; export type BeezUPCommonCountryIsoCodeAlpha3 = string; export type Company = string; export type VatNumber = string; export type BeezUPCommonEmail = string; export type AccountingEmails = Array; export type CompanyInfo = {address: Address, postalCode: PostalCode, city: City, countryIsoCodeAlpha3: BeezUPCommonCountryIsoCodeAlpha3, company: Company, vatNumber?: VatNumber | undefined, accountingEmails?: AccountingEmails | undefined}; export type UpdateApiV2UserCustomerAccountCompanyInfoArgs = {body: CompanyInfo}; export type UpdateApiV2UserCustomerAccountCompanyInfoOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Change company information * * PUT /v2/user/customer/account/companyInfo */ export const updateApiV2UserCustomerAccountCompanyInfo = async (args: UpdateApiV2UserCustomerAccountCompanyInfoArgs, options?: UpdateApiV2UserCustomerAccountCompanyInfoOptions) => { const {baseUrl = "https://api.beezup.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v2/user/customer/account/companyInfo${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 };