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.
PendingHandshake
In-flight handshake. Returned by loopback_handshake before the caller decides how to surface the URL.
Token
Bearer token used to authenticate against the platform.

Enums§

Error
All errors surfaced by the crate.

Functions§

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

Type Aliases§

Result