pub struct SessionQuery {
pub machine_id: Option<String>,
pub framework: Option<String>,
pub active_only: bool,
pub active_since: Option<DateTime<Utc>>,
pub started_after: Option<DateTime<Utc>>,
pub started_before: Option<DateTime<Utc>>,
pub github_repo: Option<String>,
pub github_issue: Option<i32>,
pub github_pr: Option<i32>,
pub limit: Option<usize>,
pub order_by: SessionOrder,
pub direction: Order,
}Expand description
Query builder for session retrieval.
SessionQuery provides a fluent API for constructing session queries
with filters, ordering, and pagination.
Default ordering is newest first (descending by started_at).
Fields§
§machine_id: Option<String>Filter by machine_id (for multi-machine scenarios)
framework: Option<String>Filter by framework (claude, cursor, gemini, codex)
active_only: boolFilter to only active sessions (ended_at IS NULL)
active_since: Option<DateTime<Utc>>Filter sessions with activity after this timestamp
started_after: Option<DateTime<Utc>>Filter sessions started after this timestamp
started_before: Option<DateTime<Utc>>Filter sessions started before this timestamp
github_repo: Option<String>Filter by GitHub repository (owner/repo format)
github_issue: Option<i32>Filter by GitHub issue number
github_pr: Option<i32>Filter by GitHub PR number
limit: Option<usize>Maximum number of sessions to return
order_by: SessionOrderOrder by field
direction: OrderSort direction (default: Desc for newest first)
Implementations§
Source§impl SessionQuery
impl SessionQuery
Sourcepub fn active_only(self) -> Self
pub fn active_only(self) -> Self
Filter to only active sessions
Sourcepub fn with_machine_id(self, machine_id: impl Into<String>) -> Self
pub fn with_machine_id(self, machine_id: impl Into<String>) -> Self
Filter by machine_id (for multi-machine scenarios)
Sourcepub fn with_framework(self, framework: impl Into<String>) -> Self
pub fn with_framework(self, framework: impl Into<String>) -> Self
Filter by framework
Sourcepub fn with_active_since(self, ts: DateTime<Utc>) -> Self
pub fn with_active_since(self, ts: DateTime<Utc>) -> Self
Filter sessions with activity since the given timestamp
Sourcepub fn with_started_after(self, ts: DateTime<Utc>) -> Self
pub fn with_started_after(self, ts: DateTime<Utc>) -> Self
Filter sessions started after the given timestamp
Sourcepub fn with_started_before(self, ts: DateTime<Utc>) -> Self
pub fn with_started_before(self, ts: DateTime<Utc>) -> Self
Filter sessions started before the given timestamp
Sourcepub fn with_github_repo(self, repo: impl Into<String>) -> Self
pub fn with_github_repo(self, repo: impl Into<String>) -> Self
Filter by GitHub repository (owner/repo format)
Sourcepub fn with_github_issue(self, issue: i32) -> Self
pub fn with_github_issue(self, issue: i32) -> Self
Filter by GitHub issue number
Sourcepub fn with_github_pr(self, pr: i32) -> Self
pub fn with_github_pr(self, pr: i32) -> Self
Filter by GitHub PR number
Sourcepub fn with_limit(self, limit: usize) -> Self
pub fn with_limit(self, limit: usize) -> Self
Set the maximum number of sessions to return
Sourcepub fn with_order_by(self, order: SessionOrder) -> Self
pub fn with_order_by(self, order: SessionOrder) -> Self
Order by the given field
Sourcepub fn with_direction(self, direction: Order) -> Self
pub fn with_direction(self, direction: Order) -> Self
Set the sort direction (Asc/Desc).
This method is consistent with EventQuery::with_direction().
Sourcepub fn ascending(self) -> Self
pub fn ascending(self) -> Self
Set ascending order (convenience method).
Equivalent to .with_direction(Order::Asc).
Sourcepub fn descending(self) -> Self
pub fn descending(self) -> Self
Set descending order (convenience method).
Equivalent to .with_direction(Order::Desc).
Trait Implementations§
Source§impl Clone for SessionQuery
impl Clone for SessionQuery
Source§fn clone(&self) -> SessionQuery
fn clone(&self) -> SessionQuery
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more