Skip to content
DocumentationGenerate and use an SDK
On this page

Page resources

Open Markdownllms.txtView source

Last updated

This recipe exports exact Rust and TypeScript clients from one accepted Build and uses them without reimplementing Planning, Build, Deployment, or Authority.

The language APIs and outputs below are illustrative end-product examples.

1. Export receipted clients

$ one export client rust build:sha256:cc80
package parcelhub-orders-rust@1.4.0
artifact artifact:sha256:aa31…
projection projection:sha256:118f…

$ one export client typescript build:sha256:cc80
package @parcelhub/orders@1.4.0
artifact artifact:sha256:c124…
projection projection:sha256:98bd…

Each projection records the contract revision, profile, toolchain, generated files, unsupported features, and loss.

2. Call the operation from Rust

use parcelhub_orders::{Client, GetOrderRequest, OrderResult};

let result = Client::from_binding(binding)
    .orders()
    .get(GetOrderRequest { customer_id, order_id })
    .await?;

match result {
    OrderResult::Ready(order) => show(order),
    OrderResult::Rejected(fault) => show_domain_fault(fault),
    OrderResult::Denied(denial) => request_access(denial),
    OrderResult::Failed(failure) => show_recovery(failure),
}

3. Call the same operation from TypeScript

import { OrdersClient } from "@parcelhub/orders";

const result = await OrdersClient.fromBinding(binding).orders.get({
  customerId,
  orderId,
});

switch (result.kind) {
  case "ready": return show(result.value);
  case "rejected": return showDomainFault(result.fault);
  case "denied": return requestAccess(result.denial);
  case "failed": return showRecovery(result.failure);
}

Bindings supply an exact selected protocol endpoint and client credential reference. Generated code never discovers a service, embeds a secret, selects a provider, or treats transport success as domain success.

4. Verify projection parity

one test --root OrdersRustClient --scenario ocs-conformance
one test --root OrdersTypeScriptClient --scenario ocs-conformance

See languages and SDKs.