export type JTLDataContractsKeysSteuerschluesselKey = string; export type JTLWawiTaxesPublicApiDataTransferObjectsV2TaxDomainUpdateTaxCodeCommandRequest = {id?: JTLDataContractsKeysSteuerschluesselKey | undefined, cashDiscountAccount?: string | undefined, generalLedgerAccount?: string | undefined, isAutomatic?: boolean | undefined, name?: string | undefined, number?: number | undefined}; export type PatchApiV2TaxcodesUpdateArgs = {'x-tenant-id': string, 'x-runas'?: string | undefined, 'x-companyid'?: string | undefined, body: JTLWawiTaxesPublicApiDataTransferObjectsV2TaxDomainUpdateTaxCodeCommandRequest}; export type PatchApiV2TaxcodesUpdateOptions = {baseUrl?: string | undefined, oauth2AuthorizationCode?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates an existing tax code * * PATCH /v2/taxcodes/update * * Also accepts auth: oauth2-client-credentials */ export const patchApiV2TaxcodesUpdate = async (args: PatchApiV2TaxcodesUpdateArgs, options?: PatchApiV2TaxcodesUpdateOptions) => { const {baseUrl = "https://scx-sbx.api.jtl-software.com", fetch: fetchFn = fetch, oauth2AuthorizationCode} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['x-tenant-id'] != null) headers.set("x-tenant-id", String(args['x-tenant-id'])) if (args['x-runas'] != null) headers.set("x-runas", String(args['x-runas'])) if (args['x-companyid'] != null) headers.set("x-companyid", String(args['x-companyid'])) if (oauth2AuthorizationCode !== undefined) headers.set('authorization', `Bearer ${oauth2AuthorizationCode}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/taxcodes/update${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };