services/gateway's tenantauth interceptor defaults RATION_GATEWAY_REQUIRE_TENANT_AUTH to true, but sdk/rust/ration-client had zero way to attach any credential — no WithAPIKey/WithBearerToken equivalent of what sdk/go/ration got in round 3. Every RPC the Rust SDK made against a default-config gateway failed Unauthenticated; its own doc.go-equivalent example never worked. Added CredentialInterceptor (tonic Interceptor) plus Client::connect_with_api_key/ connect_with_bearer_token and from_channel_with_api_key/ from_channel_with_bearer_token, mirroring the Go SDK's dial-option pattern. Also closed a smaller parity gap found along the way: CloseCard (round 11) was wired into gateway.proto/CLI but never added to either official SDK, so an external platform customer importing sdk/go/ration or sdk/rust/ration-client had no way to shut off a leaked/offboarded card's spending via the SDK itself. Added Client.CloseCard (Go) and Client::close_card (Rust). Verified live against the real bare-metal 8-service stack (scripts/start-individually.sh): a throwaway Go program using the real sdk/go/ration module (replace-directive to this repo) issued a card through the gateway, closed it, confirmed idempotent re-close, confirmed AdjustCardLimit now correctly rejects the closed card, and confirmed an unknown card_id fails the same way GetCard/AdjustCardLimit already do. `ration status` showed the full $100 hold released back to Available. Separately, a throwaway Rust binary against the real ration-client crate (path dependency) first proved the pre-fix gap live (Client::connect with zero credential against the real auth-required gateway -> Unauthenticated), then used connect_with_api_key to run the identical issue/close/idempotent-close/adjust-limit-rejected/unknown-card cycle successfully, independently confirmed via `ration status` that the $75 hold was released. make build (full Rust+Go+SDK), go vet across every Go module, cargo build --release, cargo clippy, cargo fmt all clean, 0 regressions. cargo test for ration-client remains pre-existing-broken only on its FakeGateway test fixture missing close_card/get_dashboard_snapshot (round 3's already-flagged, intentionally-not-fixed gap, per the no-test-infra-work standing rule) — unaffected by this change since make build never runs cargo test for this crate.
ration-client
A typed Rust client for Ration's gateway.proto
Gateway service — the Rust counterpart to
sdk/go/ration.
let mut client = ration_client::Client::connect("http://localhost:7002").await?;
let card = client
.issue_card("tenant_1", "Jane Doe", 1_000_00, "monthly", "USD")
.await?;
println!("issued {}", card.id);
let result = client
.request_bridge_funding("tenant_1", 500_00, "card settlement due")
.await?;
println!(
"granted {} of 50000 requested: {}",
result.granted_minor_units, result.explanation
);
use tokio_stream::StreamExt;
let mut events = client.stream_activity("tenant_1").await?;
while let Some(event) = events.next().await {
let event = event?;
println!("{} {}", event.kind, event.summary);
}
Client::connect dials in plaintext by default. For mTLS against a
production deployment (see pkg/mtls, infra/dev-ca/), build your own
tonic::transport::Channel with ClientTlsConfig and construct via
Client::from_channel.
Card and ActivityEvent are re-exported directly from the generated
protobuf types — this crate adds ergonomic, typed method signatures on top
of the tonic-generated client, it does not reinvent the wire format.
REST is also available as a convenience facade over this same gRPC service —
see
../../../services/gateway/internal/httpapi
— for callers who'd rather curl than link a gRPC client.