CI / test (push) Canceled after 0s
Covers Clients, Invoices, Quotes, Credits, Payments, Products, Expenses, Projects, Tasks, and Vendors, each with list, list_all, get, create, update, and delete, generated by the resource_methods! macro. Every model carries a #[serde(flatten)] extra map so fields the API returns but the crate does not model survive a get/update round-trip instead of being silently dropped. Includes a Nix dev shell (Rust via rust-overlay), a GitHub Actions CI workflow running build/test/fmt/clippy, and round-trip tests for the extra-preservation invariant. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
22 lines
603 B
Rust
22 lines
603 B
Rust
use invoiceninjars::models::ListParams;
|
|
use invoiceninjars::InvoiceNinjaClient;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> invoiceninjars::Result<()> {
|
|
let base_url =
|
|
std::env::var("IN_BASE_URL").unwrap_or_else(|_| "https://invoicing.co/api/v1".into());
|
|
let token = std::env::var("IN_API_TOKEN").expect("set IN_API_TOKEN");
|
|
|
|
let client = InvoiceNinjaClient::new(base_url, token)?;
|
|
|
|
let clients = client
|
|
.list_clients(&ListParams::new().per_page(10).sort("created_at|desc"))
|
|
.await?;
|
|
|
|
for c in clients {
|
|
println!("{:?}\t{}", c.id, c.name);
|
|
}
|
|
|
|
Ok(())
|
|
}
|