export type GetApiCoaApiTransactionArgs = {account?: number | undefined, account_id?: number | undefined, account_rollup?: boolean | undefined, account_subtype?: string | undefined, account_type?: string | undefined, accounts?: number | undefined, aggregation_fields?: string | undefined, all_time?: boolean | undefined, bank?: number | undefined, bank_description?: string | undefined, bank_id?: number | undefined, categorized?: string | undefined, credit_amount_equal?: number | undefined, credit_amount_gte?: number | undefined, credit_amount_lte?: number | undefined, credit_amount_null?: boolean | undefined, currency?: string | undefined, debit_amount_equal?: number | undefined, debit_amount_gte?: number | undefined, debit_amount_lte?: number | undefined, debit_amount_null?: boolean | undefined, department?: number | undefined, department_id?: number | undefined, department_or_unassigned?: boolean | undefined, display_opening_balance?: boolean | undefined, download?: boolean | undefined, end_date?: string | undefined, entity?: number | undefined, entity_id?: number | undefined, entity_rollup?: boolean | undefined, exclude_entity?: number | undefined, exclude_entity_id?: number | undefined, exclude_id?: number | undefined, exclude_journal?: number | undefined, exclude_reconciliation_report?: number | undefined, exclude_uncategorized_accounts?: boolean | undefined, expense_or_ap?: boolean | undefined, group?: number | undefined, group_fields?: string | undefined, group_id?: number | undefined, group_keys?: string | undefined, has_linked_fixed_asset?: string | undefined, has_parent_bank_transaction?: string | undefined, include_deleted?: boolean | undefined, include_matches?: boolean | undefined, is_not_reconciled?: boolean | undefined, is_reconciled?: boolean | undefined, journal_type?: string | undefined, journal_type__nin?: string | undefined, last_modified_at__gte?: string | undefined, last_modified_at__lte?: string | undefined, limit?: number | undefined, match_type?: ('all' | 'any') | undefined, needs_review?: boolean | undefined, no_department?: boolean | undefined, no_tag?: boolean | undefined, no_vendor?: boolean | undefined, offset?: number | undefined, opposing_account?: number | undefined, opposing_account_subtype?: string | undefined, ordering?: string | undefined, payee?: number | undefined, payee_id?: number | undefined, pivot_fields?: string | undefined, q?: string | undefined, reconciliation_report?: number | undefined, revenue_or_receivables?: boolean | undefined, shouldPivot?: boolean | undefined, sort?: string | undefined, start_date?: string | undefined, tag?: number | undefined, tag_groups?: number | undefined, tag_id?: number | undefined, vendor?: number | undefined, vendor_id?: number | undefined}; export type GetApiCoaApiTransactionOptions = {baseUrl?: string | undefined, knoxApiToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * List Chart Transactions * * GET /coa/api/transaction */ export const getApiCoaApiTransaction = async (args: GetApiCoaApiTransactionArgs, options?: GetApiCoaApiTransactionOptions) => { const {baseUrl = "https://api.meetcampfire.com", fetch: fetchFn = fetch, knoxApiToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.account != null) query.append("account", String(args.account)) if (args.account_id != null) query.append("account_id", String(args.account_id)) if (args.account_rollup != null) query.append("account_rollup", String(args.account_rollup)) if (args.account_subtype != null) query.append("account_subtype", String(args.account_subtype)) if (args.account_type != null) query.append("account_type", String(args.account_type)) if (args.accounts != null) query.append("accounts", String(args.accounts)) if (args.aggregation_fields != null) query.append("aggregation_fields", String(args.aggregation_fields)) if (args.all_time != null) query.append("all_time", String(args.all_time)) if (args.bank != null) query.append("bank", String(args.bank)) if (args.bank_description != null) query.append("bank_description", String(args.bank_description)) if (args.bank_id != null) query.append("bank_id", String(args.bank_id)) if (args.categorized != null) query.append("categorized", String(args.categorized)) if (args.credit_amount_equal != null) query.append("credit_amount_equal", String(args.credit_amount_equal)) if (args.credit_amount_gte != null) query.append("credit_amount_gte", String(args.credit_amount_gte)) if (args.credit_amount_lte != null) query.append("credit_amount_lte", String(args.credit_amount_lte)) if (args.credit_amount_null != null) query.append("credit_amount_null", String(args.credit_amount_null)) if (args.currency != null) query.append("currency", String(args.currency)) if (args.debit_amount_equal != null) query.append("debit_amount_equal", String(args.debit_amount_equal)) if (args.debit_amount_gte != null) query.append("debit_amount_gte", String(args.debit_amount_gte)) if (args.debit_amount_lte != null) query.append("debit_amount_lte", String(args.debit_amount_lte)) if (args.debit_amount_null != null) query.append("debit_amount_null", String(args.debit_amount_null)) if (args.department != null) query.append("department", String(args.department)) if (args.department_id != null) query.append("department_id", String(args.department_id)) if (args.department_or_unassigned != null) query.append("department_or_unassigned", String(args.department_or_unassigned)) if (args.display_opening_balance != null) query.append("display_opening_balance", String(args.display_opening_balance)) if (args.download != null) query.append("download", String(args.download)) if (args.end_date != null) query.append("end_date", String(args.end_date)) if (args.entity != null) query.append("entity", String(args.entity)) if (args.entity_id != null) query.append("entity_id", String(args.entity_id)) if (args.entity_rollup != null) query.append("entity_rollup", String(args.entity_rollup)) if (args.exclude_entity != null) query.append("exclude_entity", String(args.exclude_entity)) if (args.exclude_entity_id != null) query.append("exclude_entity_id", String(args.exclude_entity_id)) if (args.exclude_id != null) query.append("exclude_id", String(args.exclude_id)) if (args.exclude_journal != null) query.append("exclude_journal", String(args.exclude_journal)) if (args.exclude_reconciliation_report != null) query.append("exclude_reconciliation_report", String(args.exclude_reconciliation_report)) if (args.exclude_uncategorized_accounts != null) query.append("exclude_uncategorized_accounts", String(args.exclude_uncategorized_accounts)) if (args.expense_or_ap != null) query.append("expense_or_ap", String(args.expense_or_ap)) if (args.group != null) query.append("group", String(args.group)) if (args.group_fields != null) query.append("group_fields", String(args.group_fields)) if (args.group_id != null) query.append("group_id", String(args.group_id)) if (args.group_keys != null) query.append("group_keys", String(args.group_keys)) if (args.has_linked_fixed_asset != null) query.append("has_linked_fixed_asset", String(args.has_linked_fixed_asset)) if (args.has_parent_bank_transaction != null) query.append("has_parent_bank_transaction", String(args.has_parent_bank_transaction)) if (args.include_deleted != null) query.append("include_deleted", String(args.include_deleted)) if (args.include_matches != null) query.append("include_matches", String(args.include_matches)) if (args.is_not_reconciled != null) query.append("is_not_reconciled", String(args.is_not_reconciled)) if (args.is_reconciled != null) query.append("is_reconciled", String(args.is_reconciled)) if (args.journal_type != null) query.append("journal_type", String(args.journal_type)) if (args.journal_type__nin != null) query.append("journal_type__nin", String(args.journal_type__nin)) if (args.last_modified_at__gte != null) query.append("last_modified_at__gte", String(args.last_modified_at__gte)) if (args.last_modified_at__lte != null) query.append("last_modified_at__lte", String(args.last_modified_at__lte)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.match_type != null) query.append("match_type", String(args.match_type)) if (args.needs_review != null) query.append("needs_review", String(args.needs_review)) if (args.no_department != null) query.append("no_department", String(args.no_department)) if (args.no_tag != null) query.append("no_tag", String(args.no_tag)) if (args.no_vendor != null) query.append("no_vendor", String(args.no_vendor)) if (args.offset != null) query.append("offset", String(args.offset)) if (args.opposing_account != null) query.append("opposing_account", String(args.opposing_account)) if (args.opposing_account_subtype != null) query.append("opposing_account_subtype", String(args.opposing_account_subtype)) if (args.ordering != null) query.append("ordering", String(args.ordering)) if (args.payee != null) query.append("payee", String(args.payee)) if (args.payee_id != null) query.append("payee_id", String(args.payee_id)) if (args.pivot_fields != null) query.append("pivot_fields", String(args.pivot_fields)) if (args.q != null) query.append("q", String(args.q)) if (args.reconciliation_report != null) query.append("reconciliation_report", String(args.reconciliation_report)) if (args.revenue_or_receivables != null) query.append("revenue_or_receivables", String(args.revenue_or_receivables)) if (args.shouldPivot != null) query.append("shouldPivot", String(args.shouldPivot)) if (args.sort != null) query.append("sort", String(args.sort)) if (args.start_date != null) query.append("start_date", String(args.start_date)) if (args.tag != null) query.append("tag", String(args.tag)) if (args.tag_groups != null) query.append("tag_groups", String(args.tag_groups)) if (args.tag_id != null) query.append("tag_id", String(args.tag_id)) if (args.vendor != null) query.append("vendor", String(args.vendor)) if (args.vendor_id != null) query.append("vendor_id", String(args.vendor_id)) if (knoxApiToken !== undefined) headers.set("Authorization", knoxApiToken) const url = `${baseUrl.replace(/\/+$/, '')}/coa/api/transaction${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };