pub struct EventsResource<'c> { /* private fields */ }Expand description
client.events() — accessor for the SSE event stream.
Implementations§
Source§impl<'c> EventsResource<'c>
impl<'c> EventsResource<'c>
Sourcepub async fn stream(self) -> Result<EventsStream, PulseError>
pub async fn stream(self) -> Result<EventsStream, PulseError>
Subscribes to GET /api/pulse/events/stream and returns a Stream
of parsed events.
The future resolves once the HTTP response head is received (so auth
errors surface immediately rather than on the first poll). After
that, each call to StreamExt::next yields the next event as it
arrives on the wire.
Sourcepub async fn replay(
self,
affecting_state: &str,
key: &str,
from: &str,
to: &str,
limit: u32,
) -> Result<Vec<Value>, PulseError>
pub async fn replay( self, affecting_state: &str, key: &str, from: &str, to: &str, limit: u32, ) -> Result<Vec<Value>, PulseError>
GET /api/pulse/iq/agents/{affecting_state}/state/replay/{key}?from=&to=&limit=
— B-113 state-change replay.
Returns the ordered list of changes that touched a state key between
two instants. affecting_state is the agent whose state store to
inspect; key is the state key. from / to accept the same specs
as iq().get_as_of(...) (now, -1h, ISO-8601, epoch millis);
limit caps the number of changes (server default 100). Each change
carries timestamp, changeType (PUT / DELETE), the resulting
value, and eventId when known. The server’s enclosing
{..., changes:[...]} envelope is unwrapped — only the changes
array is returned (empty when the response omits it).
let changes = client
.events()
.replay("user-sessions", "u42", "-1h", "now", 100)
.await?;