FerrisKey Rust SDK
Design Philosophy
This SDK is built with a focus on:
-
Zero Custom Macros: All abstractions use native Rust generics, traits, and type-state patterns. No procedural macros are introduced.
-
Type-Driven Design: Invalid states are unrepresentable at compile time. The builder pattern uses phantom types to track configuration state.
-
tower::Service Integration: The transport layer is built on
tower::Service, enabling seamless composition of middleware (retry, timeout, rate-limiting). -
Extension Traits: Functionality is organized via extension traits, allowing opt-in features without bloating the core API.
Quick Start
use ferriskey_sdk::prelude::*;
# async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Configure the SDK
let config = SdkConfig::builder("https://api.ferriskey.com")
.auth(AuthStrategy::Bearer("your-token".into()))
.build();
// Create SDK with transport
let sdk = FerriskeySdk::builder(config).transport(HpxTransport::default()).build();
// Execute operations
let input = OperationInput::builder().path_param("realm", "master").build();
let response = sdk.execute_operation("getRealm", input).await?;
# Ok(())
# }
Middleware Composition
use ferriskey_sdk::{AuthStrategy, FerriskeySdk, HpxTransport, SdkConfig};
# fn example() -> Result<(), Box<dyn std::error::Error>> {
let config = SdkConfig::builder("https://api.ferriskey.com")
.auth(AuthStrategy::Bearer("your-token".into()))
.build();
let transport = HpxTransport::default();
let sdk = FerriskeySdk::builder(config).transport(transport).build();
# Ok(())
# }