#api-client #settings #deserialize #erpnext

erpnext_client

A simple API client for interacting with Frappe/ERPNext

2 unstable releases

Uses new Rust 2024

new 0.2.0 Apr 6, 2025
0.1.0 Apr 5, 2025

#961 in Parser implementations

Download history 219/week @ 2025-04-02

219 downloads per month

MIT license

14KB
219 lines

Erpnext Client

An async Rust client for interacting with ERPNext via their API.

Supports reading, inserting, and updating doctypes using basic authentication.

Todo

  • search doctypes with filter

🚀 Usage

use erpnext_client::{Client, Settings};
use secrecy::SecretString;
use serde::Deserialize;

#[derive(Debug, Deserialize)]
struct Customer {
    name: String,
    customer_name: String,
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let settings = Settings {
        url: "https://example.com".into(),
        key: "your-api-key".into(),
        secret: SecretString::new("your-secret-key".into()),
    };

    let client = Client::new(settings);

    if let Some(customer) = client
        .get_doctype_by_name::<Customer>("Customer", "CUST-0001")
        .await?
    {
        println!("Customer: {:?}", customer);
    }

    Ok(())
}

Dependencies

~5–16MB
~202K SLoC