Skip to main content

Crate wavekat_platform_client

Crate wavekat_platform_client 

Source
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_handshake returns 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.
HandshakeOptions
Tunables for loopback_handshake.
HandshakeOutcome
Result of a successful handshake.
Me
The signed-in user, as returned by GET /api/me.
Page
One page of GET /api/voice/{R}.
PendingHandshake
In-flight handshake. Returned by loopback_handshake before the caller decides how to surface the URL.
SyncEnvelope
Wire-level envelope that every sync record carries.
SyncRequest
Body shape for POST /api/voice/{R}/sync.
SyncResponse
Response from POST /api/voice/{R}/sync.
Token
Bearer token used to authenticate against the platform.
VoiceCallRecord
One historical call as it crosses the wire from the daemon up to the platform.
VoiceCalls
Marker for the /api/voice/calls/{sync,list} endpoint pair.
VoiceCallsQuery
Query params for GET /api/voice/calls. All fields optional — the default returns the newest page.

Enums§

Error
All errors surfaced by the crate.
VoiceCallDirection
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.
VoiceCallDisposition
User-visible disposition. Derived from VoiceCallEndReason by the daemon; the platform stores both, so future UI surfaces can read either without re-deriving.
VoiceCallEndReason
Finer-grained terminal reason — kept distinct from VoiceCallDisposition because the disposition collapses hangup_local and hangup_remote to Answered, losing the “who hung up?” answer the row otherwise carries.

Traits§

HasSyncEnvelope
Records that carry a SyncEnvelope expose it via this trait so the bridge crate can stamp the schemaVersion field uniformly across resources. One-line impl per record type:
SyncEndpoint
One sync-able platform resource.

Functions§

loopback_handshake
Bind the loopback listener and compute the platform sign-in URL.

Type Aliases§

Result