pub struct IQResource<'c> { /* private fields */ }Expand description
client.iq() — accessor for Interactive Queries.
Implementations§
Source§impl<'c> IQResource<'c>
impl<'c> IQResource<'c>
Sourcepub async fn summary(self, agent_id: &str) -> Result<Value, PulseError>
pub async fn summary(self, agent_id: &str) -> Result<Value, PulseError>
GET /api/pulse/iq/agents/{id}/state — headline state summary.
Returns the IQSummary Value — always carries agentId,
queryable, backend, hotSize, hotBytes, coldSize,
coldBytes, lastCheckpointId, totalSize. When the agent has
no live streaming backend: queryable=false, backend="none",
numerics 0, lastCheckpointId=-1.
Sourcepub async fn get(self, agent_id: &str, key: &str) -> Result<Value, PulseError>
pub async fn get(self, agent_id: &str, key: &str) -> Result<Value, PulseError>
GET /api/pulse/iq/agents/{id}/state/value/{key} — point lookup.
Returns the IQValue Value (agentId, key, value — value
can be any JSON type including null).
§Errors
Returns PulseError::NotFound when the key is absent OR the
agent is not queryable. Inspect the variant’s body field:
error == "Key not found" vs error == "Agent has no queryable state" (with reason field) — to distinguish.
Sourcepub async fn get_as_of(
self,
agent_id: &str,
key: &str,
as_of: &str,
) -> Result<Value, PulseError>
pub async fn get_as_of( self, agent_id: &str, key: &str, as_of: &str, ) -> Result<Value, PulseError>
GET /api/pulse/iq/agents/{id}/state/value/{key}?as_of=<spec> —
B-113 time-travel point lookup.
Reads the value as it was at a past instant instead of the live value.
as_of accepts now, a relative offset (-1h, -30m, -7d), an
ISO-8601 instant, or epoch millis — passed through to the server
verbatim. The response then also carries asOf (resolved epoch ms)
alongside the usual agentId, key, value:
let state = client.iq().get_as_of("user-sessions", "u42", "-1h").await?;§Errors
Same as get — PulseError::NotFound when the key is
absent (at that instant) OR the agent is not queryable.
Sourcepub async fn diff(
self,
agent_id: &str,
key: &str,
from: &str,
to: &str,
) -> Result<Value, PulseError>
pub async fn diff( self, agent_id: &str, key: &str, from: &str, to: &str, ) -> Result<Value, PulseError>
GET /api/pulse/iq/agents/{id}/state/diff/{key}?from=&to= — B-113
field-level state diff.
Returns the delta of key’s state between two instants. from and
to accept the same specs as get_as_of; they
default server-side to -1h / now when blank, but this method
always sends them explicitly. The response carries
{agentId, key, fromTs, toTs, changes} where changes maps each
changed field to {delta?, from, to} (delta present for numeric
fields), or {added} / {removed}:
let d = client.iq().diff("user-sessions", "u42", "-1h", "now").await?;
let delta = d["changes"]["cart_value"]["delta"].as_f64();Sourcepub async fn scan(
self,
agent_id: &str,
opts: IQScanOptions,
) -> Result<Value, PulseError>
pub async fn scan( self, agent_id: &str, opts: IQScanOptions, ) -> Result<Value, PulseError>
GET /api/pulse/iq/agents/{id}/state/scan — paginated range scan.
Inspect truncated to decide if more data exists; paginate by
setting opts.start on the next call to the last returned key
plus a sentinel suffix.
Sourcepub async fn list_keys(
self,
agent_id: &str,
opts: IQScanOptions,
) -> Result<Value, PulseError>
pub async fn list_keys( self, agent_id: &str, opts: IQScanOptions, ) -> Result<Value, PulseError>
GET /api/pulse/iq/agents/{id}/state/keys — keys-only range scan.
Same shape as scan minus the values; keys field
is a JSON array of strings.
Sourcepub async fn query(
self,
agent_id: &str,
opts: IQQueryOptions,
) -> Result<Value, PulseError>
pub async fn query( self, agent_id: &str, opts: IQQueryOptions, ) -> Result<Value, PulseError>
POST /api/pulse/iq/agents/{id}/state/query — filtered / projected
/ grouped query.
When opts.group_by is set, the response shape is
{groups: [{groupKey, count}], groupCount, ...} instead of
{entries: [...], count, ...}.
§Errors
PulseError::Validationon invalid filter syntax (HTTP 400)PulseError::NotFoundwhen the agent is not queryable