Expand description
Rust client for the WaveKat platform.
Reusable across consumers (the wavekat-cli binary wk, the
WaveKat desktop daemon, future WaveKat tools) so platform auth and
HTTP plumbing have one implementation, not many.
§Quick start
use wavekat_platform_client::{loopback_handshake, Client, HandshakeOptions};
let pending = loopback_handshake(
"https://platform.wavekat.com",
HandshakeOptions::default(),
)?;
println!("Open: {}", pending.url());
let outcome = pending.wait().await?;
let client = Client::new("https://platform.wavekat.com", outcome.token)?;
let me = client.whoami().await?;
println!("signed in as {}", me.login);§What this crate is (and isn’t)
- Storage-agnostic.
Client::new(base_url, token)is the contract. The crate never reads or writes disk; consumers pick where the token lives (config file, OS keychain, env var, in-memory test fixture). - Browser-agnostic.
loopback_handshakereturns the sign-in URL; the caller decides how to open it (webbrowser::open,shell.openExternal,println!, …). - Runtime-light. Async surface uses
reqwest; consumers bring their own tokio runtime.
Structs§
- Client
- HTTP client with the bearer token baked into its default headers.
- Handshake
Options - Tunables for
loopback_handshake. - Handshake
Outcome - Result of a successful handshake.
- Me
- The signed-in user, as returned by
GET /api/me. - Page
- One page of
GET /api/voice/{R}. - Pending
Handshake - In-flight handshake. Returned by
loopback_handshakebefore the caller decides how to surface the URL. - Sync
Envelope - Wire-level envelope that every sync record carries.
- Sync
Request - Body shape for
POST /api/voice/{R}/sync. - Sync
Response - Response from
POST /api/voice/{R}/sync. - Token
- Bearer token used to authenticate against the platform.
- Voice
Call Record - One historical call as it crosses the wire from the daemon up to the platform.
- Voice
Calls - Marker for the
/api/voice/calls/{sync,list}endpoint pair. - Voice
Calls Query - Query params for
GET /api/voice/calls. All fields optional — the default returns the newest page.
Enums§
- Error
- All errors surfaced by the crate.
- Voice
Call Direction - Inbound vs. outbound. Wire-stable snake_case strings — never
renumber or rename. New states (e.g.
internal) would be a wire addition, not a replacement. - Voice
Call Disposition - User-visible disposition. Derived from
VoiceCallEndReasonby the daemon; the platform stores both, so future UI surfaces can read either without re-deriving. - Voice
Call EndReason - Finer-grained terminal reason — kept distinct from
VoiceCallDispositionbecause the disposition collapseshangup_localandhangup_remotetoAnswered, losing the “who hung up?” answer the row otherwise carries.
Traits§
- HasSync
Envelope - Records that carry a
SyncEnvelopeexpose it via this trait so the bridge crate can stamp theschemaVersionfield uniformly across resources. One-line impl per record type: - Sync
Endpoint - One sync-able platform resource.
Functions§
- loopback_
handshake - Bind the loopback listener and compute the platform sign-in URL.