Skip to main content

SyncEndpoint

Trait SyncEndpoint 

Source
pub trait SyncEndpoint {
    type Record: Serialize + DeserializeOwned + Send + Sync + 'static;
    type Query: Serialize + Send + Sync;

    const RESOURCE: &'static str;
    const CURRENT_SCHEMA_VERSION: u32 = 1;
}
Expand description

One sync-able platform resource.

Implemented by zero-sized marker types — you call methods like client.sync::<VoiceCalls>(&items) rather than constructing a VoiceCalls value.

Required Associated Constants§

Source

const RESOURCE: &'static str

Path segment under /api/voice/. e.g. "calls", "recordings".

Combined into the full paths POST /api/voice/{RESOURCE}/sync and GET /api/voice/{RESOURCE}.

Provided Associated Constants§

Source

const CURRENT_SCHEMA_VERSION: u32 = 1

Current wire-schema version for this resource’s Record type.

Bumped when the meaning of an existing field changes (a rare, deliberate event). Additive field changes don’t require a version bump — they ride on the additive-only policy (see wavekat-voice/docs/21-platform-call-history-sync.md §“Versioning and forward compatibility”).

Used by Client::sync so consumers don’t manage the version themselves — upgrading the bridge crate picks up the right number automatically. Default is 1.

Required Associated Types§

Source

type Record: Serialize + DeserializeOwned + Send + Sync + 'static

One row’s worth of data. Must round-trip through JSON; the wire shape uses camelCase per the platform’s Hono/Zod convention (apply #[serde(rename_all = "camelCase")] on your struct).

Records must embed SyncEnvelope via #[serde(flatten)] pub envelope: SyncEnvelope so the schemaVersion + extras fields appear at the top of the JSON object alongside the resource-specific columns. The trait doesn’t enforce this via an associated type because #[serde(flatten)] is a serde attribute (not a Rust trait bound), but every record type ships with the envelope and Client::sync relies on the field name schemaVersion. See VoiceCallRecord for the canonical shape.

Source

type Query: Serialize + Send + Sync

Query params for GET /api/voice/{RESOURCE}. Typically a cursor (before as RFC 3339) plus a limit and any resource-specific filters (e.g. account_id). Serialized as URL query.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§