Rust Examples
These examples use the official Ticksupply Rust client. For raw HTTP examples, see the cURL page. The crate is async-first — every API call returns aFuture, so a Tokio (or compatible) runtime is required.
Setup
Add the client to yourCargo.toml:
Catalog operations
List exchanges
List instruments
Paginate through instruments
Use.stream() to auto-paginate; the stream yields each row across every page.
List datastreams
Subscription operations
Create a subscription
List subscriptions
Manage a subscription
Export operations
Create an export
create(...) accepts anything that implements IntoTimestamp — chrono::DateTime<Utc> (with the default chrono feature), time::OffsetDateTime (with the time feature), or raw i64 nanoseconds.
Poll for completion and download
Artifact URLs are short-lived pre-signed URLs — typically valid for a few minutes. Re-call
get_download if a URL has expired.List exports
Export schemas
Schema content is built from typed values inticksupply::resources::export_schemas — SchemaContent, SchemaColumn, MetaExtraction, JsonExtraction, ExchangeExtractor, plus enums for StreamCategory, MetaValue, TimestampFormat, and DataType. Build a SchemaContent once with the fluent builder, then pass it to any mutation (create, update, update_draft, or inline_content).
List schemas
Get a schema with column definitions
Build schema content
Create a saved schema
Iterate via the draft workflow
for_id returns a SchemaHandle so you don’t repeat the schema id on each call. The handle hosts every schema-relative operation.
update directly:
Use a stored schema in an export
Pass either a built-in name ("raw", "normalized") or a stored schema id ("sch_…"):
Use an inline schema
For one-off custom mappings without saving a schema, pass aSchemaContent to .inline_content(...):
.inline_schema(serde_json::Value) accepts raw JSON.
Delete a schema
Availability
Billing
Idempotency
Every mutating builder —create, delete, pause, resume, cancel — accepts .idempotency_key(...). Pass any UUID format (v1/v4/v7, up to 128 chars). If the response is lost (crash, timeout) and you retry with the same key, the server returns the original result instead of executing the operation twice.
idempotency_key for retries from your own code — e.g. after a process crash or when resuming a job queue.
Error handling
The client automatically retries on transient errors (5xx, timeouts) with exponential backoff. You only need to handle business-logic errors like
NotFound and AlreadyExists.Every error variant carries a
request_id field sourced from the X-Request-Id response header. Include it when reporting issues to support — it uniquely identifies the failed request in our server logs.