Skip to content

Rust client

Two crates cover Rust:

  • chelsea-api is a typed client generated from Chelsea’s OpenAPI document.
  • chelsea-core is what a native app needs on top of it: finding an install, signing in through the browser, renewing tokens, the live connection and the daily calls for tasks, the timer and time entries. The desktop app and the command line are built on it.

It covers the areas a native app uses: tasks, projects, the timer, time entries, notifications, the current user, search and the public instance document.

use chelsea_api::HttpClient;
let client = HttpClient::new()
.with_base_url("https://chelsea.example.com/api/v1")
.with_api_key(api_token);
let task = client.get_task("task-id").await?;
  • Authentication is an API token, sent as a bearer token.
  • with_base_url must include /api/v1.
  • Each operation is a method named after its operationId in snake case, and returns the typed body of each documented error.

It keeps working when a newer server adds a field to a response or a value to an enum. A removed field, a new required request field or a changed status code needs a regenerated client.

  • Discovery reads an install’s instance document and refuses an address that isn’t a Chelsea install, or uses plain http anywhere but your own computer.
  • Sign-in opens the browser with PKCE and picks up the answer on a local address. No token to copy.
  • Sessions hold the token pair, renew it before it expires and retry a call once after a 401. With the keychain feature, the pair is kept in the system keychain.
  • Timer, tasks and time entries give an app the daily calls without writing HTTP itself.