export type FieldAssignments = Array<{field_id: string, field_value_id: string}>; export type CashMatchAdjustment = {account_id: string, vendor_id?: string | undefined, fields?: FieldAssignments | undefined}; export type MatchBankTransactionsRequest = {transaction_ids: Array, bill_ids?: Array | undefined, reimbursement_ids?: Array | undefined, charge_ids?: Array | undefined, invoice_ids?: Array | undefined, credit_memo_ids?: Array | undefined, bill_payment_ids?: Array | undefined, invoice_payment_ids?: Array | undefined, journal_entry_ids?: Array | undefined, vendor_credit_ids?: Array | undefined, fees_account_id?: string | undefined, reconciliation_adjustment?: CashMatchAdjustment | undefined}; export type CreateApiBankTransactionsReconcileTransactionsArgs = {body: MatchBankTransactionsRequest}; export type CreateApiBankTransactionsReconcileTransactionsOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Matches bank transactions to existing records * * POST /bank-transactions/reconcile/transactions */ export const createApiBankTransactionsReconcileTransactions = async (args: CreateApiBankTransactionsReconcileTransactionsArgs, options?: CreateApiBankTransactionsReconcileTransactionsOptions) => { const {baseUrl = "https://api.rillet.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/bank-transactions/reconcile/transactions${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 undefined };