TreeDX Rust SDK
treedx is the generic Rust SDK for TreeDX. The library crate is
treedx. It implements the shared packages/sdk-spec architecture, follows
docs/api/openapi.yaml, and does not encode TreeSeed product semantics.
packages/trsd-sdk is a downstream TreeSeed consumer/reference only.
The current sdk-manifest.yaml reports modules, capabilities, and test roots as
implemented. The SDK exposes all 113 /api/v1 OpenAPI operations through
first-class module methods and a validated raw operation fallback.
Install
Add the crate:
Use the library crate:
use ;
Configure Client
use ;
let client = new;
The client also supports custom auth providers and injected transports for tests or embedding.
Authenticate
Bearer authentication uses the Authorization: Bearer <token> header. Tokens
may come from TreeDxConfig.token or an auth provider. The SDK must not place
production identity in request JSON and must not log bearer tokens.
Basic Health Call
# async
Repository Query
Repository-scoped query helpers live under client.query():
# async
Workspace File Lifecycle
Workspace-scoped file helpers live under client.workspaces() and
client.files():
# async
Blob Upload And Download
Binary helpers use bytes::Bytes and do not expose string constructors for
binary upload bodies.
# async
Multipart helpers expose create, part upload, complete, and abort.
Graph And Context Query
# async
Federated Query
Federation helpers use portfolio/global TreeDX routes rather than a single configured repository:
# async
Scoped Admin And Internal Modules
Full OpenAPI coverage includes sensitive scoped modules: Admin, Audit, Policy, SearchIndex, and FederationInternal. These APIs require appropriate TreeDX credentials and should be used carefully against production systems. They remain generic TreeDX APIs and do not encode TreeSeed product semantics.
The raw operation fallback validates method/path pairs against generated OpenAPI metadata before dispatch.
Error Handling
Errors are exposed as TreeDxApiError with status, code, message,
details, and payload. Network failures use status=0 and
code="network_error".
Pagination
TreeDxPage and TreeDxCursor preserve opaque server-owned cursor values and
nextCursor/hasMore metadata.
Binary And Multipart
Binary payloads use bytes::Bytes. Multipart part numbers are passed through to
TreeDX without SDK renumbering.
Conformance
The crate loads Phase 7 black-box scenario records and reports NotConfigured
until live scenario dispatch is implemented. It must not fake conformance
success.
Integration
Integration tests call a live TreeDX server only when TREEDX_BASE_URL is set.
Without that environment variable, they pass cleanly by reporting
not-configured behavior.
Development Commands