ip-allocator-client

Crates.ioip-allocator-client
lib.rsip-allocator-client
version0.2.1
created_at2025-11-04 02:42:06.508793+00
updated_at2025-11-07 04:58:20.593932+00
descriptionRust API client for ip-allocator-webserver
homepage
repositoryhttps://github.com/r33drichards/ip-allocator-webserver
max_upload_size
id1915604
size65,612
(r33drichards)

documentation

README

IP Allocator Client

Rust API client for the IP Allocator webserver, auto-generated from the OpenAPI specification using progenitor.

Installation

Add this to your Cargo.toml:

[dependencies]
ip-allocator-client = "0.1"

Usage

use ip_allocator_client::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a new client
    let client = Client::new("http://localhost:8000")?;

    // Borrow an item from the freelist
    let result = client.handlers_ip_borrow().await?;
    println!("Borrowed item: {:?}", result);

    // Return an item
    let return_result = client.handlers_ip_return_item(
        &ip_allocator_client::types::ReturnInput {
            item: serde_json::json!({"ip": "192.168.1.1"}),
        }
    ).await?;
    println!("Return operation: {:?}", return_result);

    // Check operation status
    let status = client.handlers_ip_get_operation_status(&return_result.operation_id).await?;
    println!("Operation status: {:?}", status);

    Ok(())
}

Features

  • Fully typed API client generated from OpenAPI spec
  • Async/await support via tokio
  • Built on reqwest with rustls for TLS
  • Comprehensive error handling

Development

This SDK is auto-generated from the OpenAPI specification. To regenerate:

  1. Update the OpenAPI spec: cargo run --release -- --print-openapi > openapi.json
  2. Rebuild the client: cd ip-allocator-client && cargo build

License

MIT

Commit count: 0

cargo fmt