Skip to main content

wavekat_platform_client/
lib.rs

1//! Rust client for the WaveKat platform.
2//!
3//! Reusable across consumers (the [`wavekat-cli`] binary `wk`, the
4//! WaveKat desktop daemon, future WaveKat tools) so platform auth and
5//! HTTP plumbing have one implementation, not many.
6//!
7//! ## Quick start
8//!
9//! ```no_run
10//! use wavekat_platform_client::{loopback_handshake, Client, HandshakeOptions};
11//!
12//! # async fn run() -> wavekat_platform_client::Result<()> {
13//! let pending = loopback_handshake(
14//!     "https://platform.wavekat.com",
15//!     HandshakeOptions::default(),
16//! )?;
17//! println!("Open: {}", pending.url());
18//! let outcome = pending.wait().await?;
19//!
20//! let client = Client::new("https://platform.wavekat.com", outcome.token)?;
21//! let me = client.whoami().await?;
22//! println!("signed in as {}", me.login);
23//! # Ok(()) }
24//! ```
25//!
26//! ## What this crate is (and isn't)
27//!
28//! - **Storage-agnostic.** `Client::new(base_url, token)` is the contract.
29//!   The crate never reads or writes disk; consumers pick where the token
30//!   lives (config file, OS keychain, env var, in-memory test fixture).
31//! - **Browser-agnostic.** [`loopback_handshake`] returns the sign-in URL;
32//!   the caller decides how to open it (`webbrowser::open`,
33//!   `shell.openExternal`, `println!`, …).
34//! - **Runtime-light.** Async surface uses `reqwest`; consumers bring
35//!   their own tokio runtime.
36//!
37//! [`wavekat-cli`]: https://github.com/wavekat/wavekat-cli
38
39mod client;
40mod error;
41mod me;
42mod oauth;
43mod sync;
44mod token;
45mod voice;
46
47pub use client::Client;
48pub use error::{Error, Result};
49pub use me::Me;
50pub use oauth::{loopback_handshake, HandshakeOptions, HandshakeOutcome, PendingHandshake};
51pub use sync::{HasSyncEnvelope, Page, SyncEndpoint, SyncEnvelope, SyncRequest, SyncResponse};
52pub use token::Token;
53pub use voice::{
54    VoiceCallDirection, VoiceCallDisposition, VoiceCallEndReason, VoiceCallRecord, VoiceCalls,
55    VoiceCallsQuery,
56};