SessionQuery

Struct SessionQuery 

Source
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: bool

Filter 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: SessionOrder

Order by field

§direction: Order

Sort direction (default: Desc for newest first)

Implementations§

Source§

impl SessionQuery

Source

pub fn new() -> Self

Create a new empty query (defaults to recent sessions first)

Source

pub fn active_only(self) -> Self

Filter to only active sessions

Source

pub fn with_machine_id(self, machine_id: impl Into<String>) -> Self

Filter by machine_id (for multi-machine scenarios)

Source

pub fn with_framework(self, framework: impl Into<String>) -> Self

Filter by framework

Source

pub fn with_active_since(self, ts: DateTime<Utc>) -> Self

Filter sessions with activity since the given timestamp

Source

pub fn with_started_after(self, ts: DateTime<Utc>) -> Self

Filter sessions started after the given timestamp

Source

pub fn with_started_before(self, ts: DateTime<Utc>) -> Self

Filter sessions started before the given timestamp

Source

pub fn with_github_repo(self, repo: impl Into<String>) -> Self

Filter by GitHub repository (owner/repo format)

Source

pub fn with_github_issue(self, issue: i32) -> Self

Filter by GitHub issue number

Source

pub fn with_github_pr(self, pr: i32) -> Self

Filter by GitHub PR number

Source

pub fn with_limit(self, limit: usize) -> Self

Set the maximum number of sessions to return

Source

pub fn with_order_by(self, order: SessionOrder) -> Self

Order by the given field

Source

pub fn with_direction(self, direction: Order) -> Self

Set the sort direction (Asc/Desc).

This method is consistent with EventQuery::with_direction().

Source

pub fn ascending(self) -> Self

Set ascending order (convenience method).

Equivalent to .with_direction(Order::Asc).

Source

pub fn descending(self) -> Self

Set descending order (convenience method).

Equivalent to .with_direction(Order::Desc).

Trait Implementations§

Source§

impl Clone for SessionQuery

Source§

fn clone(&self) -> SessionQuery

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for SessionQuery

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.