export type ExpenseType = 'COMPANY' | 'PERSONAL' | 'TRAVEL_AND_ENTERTAINMENT'; export type SplitTag = {tag_id?: string | undefined, dictionary_id?: string | undefined}; export type SplitTransaction = {amount: number, expense_type?: ExpenseType | undefined, user_id?: string | undefined, expense_category_id?: string | undefined, tax_rate_id?: string | undefined, tags?: Array | undefined}; export type UpdateTransactionSplit = {split_transactions: Array}; export type UpdateApiBusinessV2TransactionsTransactionIdSplitArgs = {transactionId: string, body: UpdateTransactionSplit}; export type UpdateApiBusinessV2TransactionsTransactionIdSplitOptions = {baseUrl?: string | undefined, standardAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Transaction Split * * PUT /business/v2/transactions/{transactionId}/split */ export const updateApiBusinessV2TransactionsTransactionIdSplit = async (args: UpdateApiBusinessV2TransactionsTransactionIdSplitArgs, options?: UpdateApiBusinessV2TransactionsTransactionIdSplitOptions) => { const {baseUrl = "https://api.soldo.com", fetch: fetchFn = fetch, standardAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (standardAuth !== undefined) headers.set('authorization', `Bearer ${standardAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/business/v2/transactions/${encodeURIComponent(String(args.transactionId))}/split${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 };