export type CreateApiApiV1LiabilitiesRecurringArgs = {body: {creationType: string, type: string, active: boolean, filter?: string | undefined, debit?: string | undefined, credit?: string | undefined, fee?: string | undefined, currency?: string | undefined, contraAccount?: string | undefined, invoiceNumber?: string | undefined, purpose?: string | undefined, costCenter?: string | undefined, paymentMethod?: string | undefined, approveGoodsReceiptInspection?: boolean | undefined, approveIncomingInvoiceInspection?: boolean | undefined, liabilityAmount?: string | undefined, liabilityCurrency?: string | undefined, value?: string | undefined}}; export type CreateApiApiV1LiabilitiesRecurringOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create recurring liability * * POST /api/v1/liabilities-recurring */ export const createApiApiV1LiabilitiesRecurring = async (args: CreateApiApiV1LiabilitiesRecurringArgs, options?: CreateApiApiV1LiabilitiesRecurringOptions) => { const {baseUrl = "https://xentral.xentral.biz", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "text/html") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/liabilities-recurring${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 res.text() };