export type CreateApiCoaApiIntercompanyJournalEntryBalanceArgs = {body: {date?: string | undefined, transactions: Array>, exchange_rates?: Array> | undefined}}; export type CreateApiCoaApiIntercompanyJournalEntryBalanceOptions = {baseUrl?: string | undefined, knoxApiToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Balance Intercompany Journal Entry * * POST /coa/api/intercompany-journal-entry/balance */ export const createApiCoaApiIntercompanyJournalEntryBalance = async (args: CreateApiCoaApiIntercompanyJournalEntryBalanceArgs, options?: CreateApiCoaApiIntercompanyJournalEntryBalanceOptions) => { const {baseUrl = "https://api.meetcampfire.com", fetch: fetchFn = fetch, knoxApiToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (knoxApiToken !== undefined) headers.set("Authorization", knoxApiToken) const url = `${baseUrl.replace(/\/+$/, '')}/coa/api/intercompany-journal-entry/balance${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 };