pub struct EventsApi<'a> { /* private fields */ }Expand description
Events API façade.
Implementations§
Source§impl<'a> EventsApi<'a>
impl<'a> EventsApi<'a>
Sourcepub fn new(client: &'a DatadogClient) -> Self
pub fn new(client: &'a DatadogClient) -> Self
Wraps an existing DatadogClient for events operations.
Sourcepub async fn list(
&self,
filter: &EventsListFilter,
from: &str,
to: &str,
limit: usize,
after: Option<&str>,
) -> Result<EventsResponse>
pub async fn list( &self, filter: &EventsListFilter, from: &str, to: &str, limit: usize, after: Option<&str>, ) -> Result<EventsResponse>
Lists events matching filter between from and to (RFC 3339
strings) capped at limit per page.
Single-page only. When after is Some, Datadog resumes
pagination at that cursor token (page[cursor] in the query
string). The next-page token is preserved on meta.page.after
of the response so callers (or EventsApi::list_all) can
iterate.
Sourcepub async fn list_all(
&self,
filter: &EventsListFilter,
from: &str,
to: &str,
limit: usize,
) -> Result<EventsResponse>
pub async fn list_all( &self, filter: &EventsListFilter, from: &str, to: &str, limit: usize, ) -> Result<EventsResponse>
Lists events, auto-paginating via cursor as needed.
limit == 0 means “fetch every match up to HARD_CAP”. Any
non-zero limit is upper-bounded by HARD_CAP to keep a single
invocation from issuing more than 10k items’ worth of requests.
Per-request page size is clamped to MAX_PAGE_LIMIT.
Termination follows cursor-pagination semantics: the loop stops
when the response omits meta.page.after (Datadog signals “no
more pages” only via the absent cursor — a short page on its own
is not a terminator) or when cap items have been collected.
The returned envelope keeps the meta and links blocks from the
last successful page so the response’s cursor reflects the
iterator’s final position (typically None when the API is
exhausted).