export type TaxObject = {id?: string | undefined, country?: string | undefined, taxCode1?: number | undefined, taxCode2?: number | undefined, taxCode3?: number | undefined, taxCode4?: number | undefined, taxCode5?: number | undefined, updatedAt?: string | undefined, createdAt?: string | undefined}; export type UpdateApiTaxesTaxIdArgs = {taxId: string, body: TaxObject}; export type UpdateApiTaxesTaxIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Tax details * * PUT /taxes/{taxId} */ export const updateApiTaxesTaxId = async (args: UpdateApiTaxesTaxIdArgs, options?: UpdateApiTaxesTaxIdOptions) => { const {baseUrl = "https://api.test.bictorys.com/pay/v1", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-API-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/taxes/${encodeURIComponent(String(args.taxId))}${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 };