Skip to main content

Crate chalk_client

Crate chalk_client 

Source
Expand description

§chalk-client

The official Chalk client library for Rust.

Provides both an HTTP/REST client (ChalkClient) and a gRPC client (ChalkGrpcClient) for online queries, bulk queries, and feature uploads. Use the gRPC client for latency-sensitive workloads; use the HTTP client for offline queries and general use.

§Quick Start

use chalk_client::ChalkClient;
use chalk_client::types::QueryOptions;
use std::collections::HashMap;

let client = ChalkClient::new()
    .client_id("your-client-id")
    .client_secret("your-client-secret")
    .environment("production")
    .build()
    .await?;

let inputs = HashMap::from([
    ("user.id".to_string(), serde_json::json!(42)),
]);
let outputs = vec!["user.age".to_string(), "user.name".to_string()];

let response = client.query(inputs, outputs, QueryOptions::default()).await?;
for feature in &response.data {
    println!("{}: {:?}", feature.field, feature.value);
}

Re-exports§

pub use http_client::BulkQueryResult;
pub use http_client::ChalkClient;
pub use grpc_client::ChalkGrpcClient;
pub use offline::OfflineQueryParams;

Modules§

auth
Token management — exchanging credentials for JWTs.
config
Configuration resolution for the Chalk client.
error
Error types for the Chalk client SDK.
gen
grpc_client
gRPC client for the Chalk feature store.
http_client
HTTP/REST client for the Chalk feature store.
offline
Fluent builder for offline query parameters.
types
JSON request and response types for the Chalk REST API.