Files
awkawbandClaude Sonnet 5 96fba9a303 Add the remaining 22 simple-CRUD resources
Finishes the mechanical rollout: every resource using
resource_methods!/crud_methods! in the SDK (list/get/create/update/
delete, no bulk/uploads/entity-actions) is now wired up, 33 in
total. recurring_quotes.rs mirrors recurring_invoices.rs the same
way quotes.rs mirrors invoices.rs, since RecurringQuote is also a
type alias for RecurringInvoice in the SDK.

client_gateway_tokens, companies, and system_logs use the SDK's
crud_methods! rather than resource_methods! (no /bulk route in
Invoice Ninja for these) - doesn't change anything here, since this
CLI doesn't expose bulk actions yet either way.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-26 16:51:51 -04:00

57 lines
2.0 KiB
Markdown

# invoiceninja-cli
A command-line client for the [Invoice Ninja](https://www.invoiceninja.com/)
v5 API, built on [`invoiceninja-sdk`](https://crates.io/crates/invoiceninja-sdk).
> **Scaffold status.** Every resource with a simple list/get/create/update/
> delete API (33 of them) is wired up — see `CLAUDE.md` for what's still
> missing (bulk actions, uploads, entity actions, non-CRUD endpoints) and
> the pattern those will follow. [`GOALS.md`](GOALS.md) covers what the
> crate is for and what it is not.
## Development
Enter the dev shell (Rust toolchain via `rust-overlay`, matching the SDK's):
```sh
nix develop
```
## Usage
Every subcommand needs an API token and, for a self-hosted install, a base
URL. Both can be passed as flags or environment variables (the same names
the SDK's own examples use):
```sh
export IN_API_TOKEN=...
# export IN_BASE_URL=https://your-domain.example/api/v1 # self-hosted only
invoiceninja-cli clients list
invoiceninja-cli clients list --all --status active,archived
invoiceninja-cli clients get <id>
invoiceninja-cli clients create --data '{"name": "Acme Inc"}'
invoiceninja-cli clients update <id> --data '{"city": "Springfield"}'
invoiceninja-cli clients delete <id>
```
`create` and `update` read the record body as JSON, from `--data` inline,
`--file <path>` (`-` for stdin), or stdin if neither flag is given.
`update` fetches the current record first and overlays the given fields on
top of it, so you only need to mention what's changing — see the comment in
`src/body.rs` for why that matters (Invoice Ninja's `PUT` is a full replace,
not a patch).
Add `--output json` to any command for the full record instead of the
table view's few key columns:
```sh
invoiceninja-cli --output json clients get <id>
```
Every other wired-up resource follows the same
`list`/`get`/`create`/`update`/`delete` shape, e.g.
`invoiceninja-cli invoices list --status active` or
`invoiceninja-cli purchase-orders get <id>`. Run `invoiceninja-cli --help`
for the full list.