1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! `koban` is a client library for the [Invoice Ninja](https://invoiceninja.com)
//! API, built for humans and AI agents.
//!
//! The library exposes an [`ApiClient`] for talking to an Invoice Ninja instance,
//! a [`Config`] for environment-first credential handling, the [`Resource`]
//! catalogue of API resource families, typed [`models`] for the common
//! resources, and a redaction helper for keeping tokens out of logs and errors.
//!
//! Typed access via the resource accessors and [`models`]:
//!
//! ```no_run
//! use koban::{ApiClient, Config};
//!
//! # async fn run() -> koban::Result<()> {
//! let client = ApiClient::new(Config::from_env()?);
//! let invoices = client.invoices().list().await?;
//! for invoice in &invoices {
//! println!("{} -> {}", invoice.number, invoice.balance);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! The raw JSON methods ([`ApiClient::get_json`] and friends) remain available as
//! a low-level escape hatch for endpoints or fields the typed layer does not
//! model.
//!
//! Token handling is environment-first via `INVOICE_NINJA_API_TOKEN` and the
//! optional `INVOICE_NINJA_BASE_URL`. Enable the `miette` feature to attach
//! diagnostic help text to [`KobanError`].
pub use ApiClient;
pub use ;
pub use ;
pub use ;
pub use Resource;
pub use Resources;
pub use redact;