greentic-distributor-client
Client trait and HTTP/WIT implementations for the greentic:distributor-api@1.0.0 world. Provides:
DistributorClientasync trait for resolving components, querying pack status, and warming packs.HttpDistributorClientfor JSON/HTTP endpoints.WitDistributorClientadapter that translates DTOs togreentic-interfaces-guestdistributor-api bindings; useGeneratedDistributorApiBindingson WASM targets to call the distributor imports.
Uses DTOs from greentic-types and supports optional auth headers and request timeouts.
Usage
use ;
use json;
let config = DistributorClientConfig ;
let client = new?;
let resp = client.resolve_component.await?;
println!;
For WIT, implement DistributorApiBindings using the generated greentic_interfaces_guest::distributor_api functions and pass it to WitDistributorClient.
GeneratedDistributorApiBindings is provided for WASM targets. On non-WASM targets it returns an error; prefer HttpDistributorClient there.
Local dev distributor
Use the companion greentic-distributor-dev crate to serve packs/components from a local directory, useful for greentic-dev and conformance tests:
use ;
use ;
let dev_source = new;
let sources = new;
let pack_bytes = sources.fetch_pack;
println!;