Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .openapi-generator-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ README.md
CLAUDE.md
LICENSE
justfile
campfire.json
.github/**
package.json
tsconfig.json
Expand Down
38 changes: 30 additions & 8 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

Auto-generated TypeScript SDK for the [Campfire API](https://api.meetcampfire.com) (accounting, AP/AR, revenue recognition, and financial reporting). Generated from an OpenAPI spec (`campfire.json`) using OpenAPI Generator v7.19.0 with the `typescript-axios` template. Uses Axios as the HTTP client.
Auto-generated TypeScript SDK for the [Campfire API](https://api.meetcampfire.com) (accounting, AP/AR, revenue recognition, and financial reporting). Generated from an OpenAPI spec (`campfire.json`) using OpenAPI Generator v7.19.0 with the `typescript-axios` template. Uses Axios as the HTTP client. API docs at https://docs.campfire.ai/api-reference.

## Build Commands

Expand All @@ -25,15 +25,29 @@ All TypeScript source files in the root directory are **auto-generated** from th

| File | Purpose |
|------|---------|
| `api.ts` | `DefaultApi` class with all API methods (the main SDK surface) |
| `api.ts` | 12 API classes organized by category (see below), plus all model types |
| `configuration.ts` | `Configuration` class for auth setup (API key) |
| `base.ts` | `BaseAPI` base class, `RequiredError`, server config |
| `common.ts` | Internal utilities (auth, serialization, request helpers) |
| `index.ts` | Re-exports from `api.ts` and `configuration.ts` |

**API classes in `api.ts`:**
- `CashManagementApi` — bank accounts and bank transactions
- `AccountsPayableApi` — bills, debit memos, bill payments
- `AccountsReceivableApi` — invoices, credit memos, invoice payments
- `CoreAccountingApi` — journal entries, budgets, fixed assets, vendor contacts
- `CompanyObjectsApi` — chart of accounts, departments, vendors, tags, cost allocations
- `RevenueRecognitionApi` — contracts, subscriptions, milestones, products
- `FinancialStatementsApi` — balance sheet, income statement, cash flow, trial balance, general ledger
- `BankReconciliationApi` — reconciliation reports and transaction matching
- `SettingsApi` — entities, currencies, files, chart account settings
- `IntegrationsApi` — webhooks
- `CustomFieldsApi` — custom field definitions
- `CoaApi` — fixed asset automation, bill amortization, transaction merging

**Key files that are NOT auto-generated:**
- `justfile` — build/generation orchestration
- `campfire.json` — OpenAPI spec (source of truth for the SDK)
- `campfire.json` — OpenAPI spec (source of truth for the SDK, downloaded from `https://api.meetcampfire.com/api/schema?format=json` with fixes applied)
- `.openapi-generator-ignore` — controls which files the generator preserves
- `.github/` — CI/CD workflows and Dependabot config
- `LICENSE` — MIT license
Expand All @@ -43,18 +57,26 @@ All TypeScript source files in the root directory are **auto-generated** from th
Authentication uses API key via `Configuration.apiKey` with the `Token` prefix. The key is sent in the `Authorization` header.

```typescript
import { DefaultApi, Configuration } from 'campfire-typescript-sdk';
import { CashManagementApi, CoreAccountingApi, Configuration } from 'campfire-typescript-sdk';

const config = new Configuration({ apiKey: `Token ${process.env.CAMPFIRE_API_KEY}` });
const api = new DefaultApi(config);

const accounts = await api.listAccounts({ limit: 50 });
const cashMgmt = new CashManagementApi(config);
const accounts = await cashMgmt.listAccounts({ limit: 50 });

const accounting = new CoreAccountingApi(config);
const entries = await accounting.coaApiJournalEntryList({ limit: 20 });
```

All methods follow the pattern: `api.methodName(params?, axiosOptions?)` returning `Promise<AxiosResponse<T>>`.

## Key Conventions

- Entity IDs are numbers
- API categories: Cash Management (accounts, bank transactions), Core Accounting (chart of accounts, journal entries, entities, departments, tags, general ledger), Accounts Payable (bills, vendors, credit/debit memos), Accounts Receivable (invoices), Revenue Recognition (contracts, subscriptions, milestones, products), Financial Statements (balance sheet, income statement, cash flow, trial balance), Bank Reconciliation, Integrations (webhooks), Custom Fields, Fixed Assets
- Entity IDs are numbers, dates are ISO 8601 `YYYY-MM-DD`
- Most list endpoints support `include_deleted=true` for soft-deleted records (returns ONLY deleted records with minimal data)
- Bulk search endpoints (POST) accept exact-match arrays optimized for performance; some support upsert
- Double-entry bookkeeping: journal entry endpoints validate that total debits equal total credits
- Multi-currency: bills, invoices, credit/debit memos, and journal entries support exchange rate handling
- Void/reopen workflow: bills, invoices, credit memos, debit memos all support void (creates reversing JE) and reopen
- Closed book periods: journal entries cannot be created/updated/deleted before closed book dates
- See `docs/` for the full method reference
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,43 @@ npm install github:rocketsciencegg/campfire-typescript-sdk#v1.0.0
## Quick Start

```typescript
import { DefaultApi, Configuration } from 'campfire-typescript-sdk';
import { CashManagementApi, Configuration } from 'campfire-typescript-sdk';

const config = new Configuration({ apiKey: `Token ${process.env.CAMPFIRE_API_KEY}` });
const api = new DefaultApi(config);
const cashMgmt = new CashManagementApi(config);

const accounts = await api.listAccounts({ limit: 50 });
const accounts = await cashMgmt.listAccounts({ limit: 50 });
console.log(accounts.data);
```

## Authentication

All API calls require an API key passed via `Configuration.apiKey` with the `Token` prefix (e.g. `Token your-api-key-here`). The key is sent in the `Authorization` header.

## API Classes

The SDK is organized into 12 API classes by category:

| Class | Description |
|-------|-------------|
| `CashManagementApi` | Bank accounts and bank transactions |
| `AccountsPayableApi` | Bills, debit memos, bill payments |
| `AccountsReceivableApi` | Invoices, credit memos, invoice payments |
| `CoreAccountingApi` | Journal entries, budgets, fixed assets, vendor contacts |
| `CompanyObjectsApi` | Chart of accounts, departments, vendors, tags, cost allocations |
| `RevenueRecognitionApi` | Contracts, subscriptions, milestones, products |
| `FinancialStatementsApi` | Balance sheet, income statement, cash flow, trial balance, general ledger |
| `BankReconciliationApi` | Reconciliation reports and transaction matching |
| `SettingsApi` | Entities, currencies, files, chart account settings |
| `IntegrationsApi` | Webhooks |
| `CustomFieldsApi` | Custom field definitions |
| `CoaApi` | Fixed asset automation, bill amortization, transaction merging |

All methods follow the pattern `api.methodName(params?, axiosOptions?)` returning `Promise<AxiosResponse<T>>`.

## API Reference

See the [generated docs](docs/) for all available methods and models.
See the [generated docs](docs/) for all available methods and models, or the [Campfire API reference](https://docs.campfire.ai/api-reference).

## How This SDK Is Generated

Expand Down
Loading