export type CreateApiApiV1ClientsClientUpdateTaxDataArgs = {'X-API-TOKEN': string, 'X-Requested-With': string, index?: string | undefined, include?: string | undefined, client: unknown}; export type CreateApiApiV1ClientsClientUpdateTaxDataOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update tax data * * POST /api/v1/clients/{client}/updateTaxData */ export const createApiApiV1ClientsClientUpdateTaxData = async (args: CreateApiApiV1ClientsClientUpdateTaxDataArgs, options?: CreateApiApiV1ClientsClientUpdateTaxDataOptions) => { const {baseUrl = "https://demo.invoiceninja.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-API-TOKEN'] != null) headers.set("X-API-TOKEN", String(args['X-API-TOKEN'])) if (args['X-Requested-With'] != null) headers.set("X-Requested-With", String(args['X-Requested-With'])) if (args.index != null) query.append("index", String(args.index)) if (args.include != null) query.append("include", String(args.include)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/clients/${encodeURIComponent(String(args.client))}/updateTaxData${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };