Skip to main content

SessionsApi

Struct SessionsApi 

Source
pub struct SessionsApi { /* private fields */ }
Expand description

Conversation sessions

Implementations§

Source§

impl SessionsApi

Source

pub async fn activate_session_branch( &self, session_id: &str, branch_id: &str, ) -> Result<ActivateSessionBranchResponse>

Switch active branch

PUT /api/v1/sessions/{sessionId}/branches/{branchId}/activate

Required scopes: sessions:write.

Source

pub async fn bulk_delete_sessions( &self, body: &BulkDeleteSessionsRequest, ) -> Result<BulkDeleteSessionsResponse>

Delete many sessions in one request

Cascades each session in turn and writes one audit entry for the batch. Ids that no longer exist come back in failed, not as an error — the caller’s intent for them is already met. Not JSON → 400; an empty list, or one over 200 ids → 400.

POST /api/v1/sessions/bulk-delete

Required scopes: sessions:write.

Source

pub async fn close_session( &self, session_id: &str, ) -> Result<CloseSessionResponse>

Close a session

DELETE /api/v1/sessions/{sessionId}

Required scopes: sessions:write.

Source

pub async fn confirm_session_todo( &self, session_id: &str, todo_id: &str, body: &Map<String, Value>, ) -> Result<Todo>

Confirm or cancel a todo execution

POST /api/v1/sessions/{sessionId}/todos/{todoId}/confirm

Required scopes: sessions:write.

Source

pub async fn create(&self, body: &CreateSessionRequest) -> Result<Session>

Create a session

POST /api/v1/sessions

Required scopes: sessions:write.

Source

pub async fn create_session_annotation( &self, session_id: &str, body: &CreateSessionAnnotationRequest, ) -> Result<CreateSessionAnnotationResponse>

Create annotation

POST /api/v1/sessions/{sessionId}/annotations

Required scopes: sessions:write.

Source

pub async fn create_session_branch( &self, session_id: &str, body: &CreateSessionBranchRequest, ) -> Result<SessionBranch>

Create a branch point in session

POST /api/v1/sessions/{sessionId}/branch

Required scopes: sessions:write.

Source

pub async fn create_session_share( &self, session_id: &str, body: &CreateSessionShareRequest, ) -> Result<CreateSessionShareResponse>

Create session share link

POST /api/v1/sessions/{sessionId}/share

Required scopes: sessions:write.

Source

pub async fn create_session_todo( &self, session_id: &str, body: &CreateSessionTodoRequest, ) -> Result<Todo>

Create a todo in session

POST /api/v1/sessions/{sessionId}/todos

Required scopes: sessions:write.

Source

pub async fn create_task(&self, body: &Value) -> Result<Map<String, Value>>

Create a standalone task

Addresses one agent, several agents (fan-out, one session each, shared parent_task_id), or a squad. The server bootstraps the session(s). due_at omitted fires immediately; a timestamp schedules it; explicit null files it in the backlog with no schedule at all.

POST /api/v1/todos

Source

pub async fn delete_session_annotation( &self, session_id: &str, annotation_id: &str, ) -> Result<DeleteSessionAnnotationResponse>

Delete annotation

DELETE /api/v1/sessions/{sessionId}/annotations/{annotationId}

Required scopes: sessions:write.

Source

pub async fn delete_session_todo( &self, session_id: &str, todo_id: &str, ) -> Result<DeleteSessionTodoResponse>

Delete a single todo

Deletes ONE todo and its background schedule row. The session and its other todos are untouched.

DELETE /api/v1/sessions/{sessionId}/todos/{todoId}

Required scopes: sessions:write.

Source

pub async fn export( &self, session_id: &str, params: &ExportSessionParams, ) -> Result<SessionExport>

Export a conversation

Two formats and no others: md (the default, text/markdown) and json (application/json, the snaga.chat.v1 envelope). Any other value is 400 with the two names in the sentence — it is not silently coerced to the default, because a client asking for html and receiving markdown would render it as text.

GET /api/v1/sessions/{sessionId}/export

Required scopes: sessions:read.

Source

pub async fn get(&self, session_id: &str) -> Result<Session>

Get a session

GET /api/v1/sessions/{sessionId}

Required scopes: sessions:read.

Source

pub async fn get_session_audit_log( &self, session_id: &str, ) -> Result<GetSessionAuditLogResponse>

Get audit log scoped to session

GET /api/v1/sessions/{sessionId}/audit-log

Required scopes: sessions:read.

Source

pub async fn get_session_messages( &self, session_id: &str, ) -> Result<GetSessionMessagesResponse>

The conversation transcript

The transcript this session’s clients render. Undescribed until 2026-09-10 and, until the same day, not a route at all: a GET here fell through to the bare-session branch and was answered with the SESSION record, whose conversation_history carries the same list. Closing that fall-through took the Android chat screen down with it, which is how the gap was found.

messages and items carry the SAME list — a client reads whichever it already reads. The active_run_* fields describe a run still in flight, so a cold launch into a chat the agent is still working in can attach to it rather than render an idle screen.

A session that does not exist is 404, not an empty list: “no messages yet” and “no such session” must not render the same.

GET /api/v1/sessions/{sessionId}/messages

Required scopes: sessions:read.

Source

pub async fn get_session_run_feedback( &self, session_id: &str, run_id: &str, params: &GetSessionRunFeedbackParams, ) -> Result<Value>

Get feedback for a run in session

GET /api/v1/sessions/{sessionId}/runs/{runId}/feedback

Required scopes: sessions:read.

Source

pub async fn get_session_share( &self, session_id: &str, ) -> Result<GetSessionShareResponse>

Get session share link status

GET /api/v1/sessions/{sessionId}/share

Required scopes: sessions:read.

Source

pub async fn list( &self, params: &ListSessionsParams, ) -> Result<ListSessionsResponse>

List sessions

GET /api/v1/sessions

Required scopes: sessions:read.

Source

pub fn list_all<'a>( &'a self, params: &'a ListSessionsParams, ) -> impl Stream<Item = Result<ListSessionsResponseItem>> + 'a

Stream every item returned by listSessions, following the cursor cursor until the server reports no further pages.

Source

pub async fn list_session_annotations( &self, session_id: &str, ) -> Result<ListSessionAnnotationsResponse>

List session annotations

GET /api/v1/sessions/{sessionId}/annotations

Required scopes: sessions:read.

Source

pub async fn list_session_artifacts( &self, session_id: &str, ) -> Result<ListSessionArtifactsResponse>

List artifacts across all runs in session

GET /api/v1/sessions/{sessionId}/artifacts

Required scopes: sessions:read.

Source

pub async fn list_session_branches( &self, session_id: &str, ) -> Result<ListSessionBranchesResponse>

List session branches

GET /api/v1/sessions/{sessionId}/branches

Required scopes: sessions:read.

Source

pub async fn list_session_todos( &self, session_id: &str, params: &ListSessionTodosParams, ) -> Result<ListSessionTodosResponse>

List session todos

GET /api/v1/sessions/{sessionId}/todos

Required scopes: sessions:read.

Source

pub async fn list_todos(&self) -> Result<ListTodosResponse>

List all todos across sessions

GET /api/v1/todos

Source

pub async fn resolve_shared_session( &self, share_id: &str, ) -> Result<ResolveSharedSessionResponse>

Resolve shared session (no auth)

GET /api/v1/shared/{shareId}

Source

pub async fn revoke_session_share( &self, session_id: &str, ) -> Result<RevokeSessionShareResponse>

Revoke session share link

DELETE /api/v1/sessions/{sessionId}/share

Required scopes: sessions:write.

Source

pub async fn run_session_todo_now( &self, session_id: &str, todo_id: &str, ) -> Result<Todo>

Run a pending todo immediately

Dispatches the todo’s run now instead of waiting for its due time. Only pending / pending_confirmation todos can be run; anything else answers 409. A recurring todo keeps its cron (next occurrence recomputed from now); a one-shot todo’s schedule entry is dropped so it cannot fire twice.

POST /api/v1/sessions/{sessionId}/todos/{todoId}/run

Required scopes: sessions:write.

Source

pub async fn send_session_message( &self, session_id: &str, body: &SendSessionMessageRequest, ) -> Result<SendSessionMessageResponse>

Send message

Submits a user message to the session and schedules a run on the bound agent. Returns 202 Accepted with the new run id; subscribe to /api/v1/runs/{runId}/events (SSE) for streaming output.

POST /api/v1/sessions/{sessionId}/messages

Required scopes: sessions:write.

Source

pub async fn set_session_run_feedback( &self, session_id: &str, run_id: &str, body: &Map<String, Value>, ) -> Result<RunFeedbackSet>

Save feedback/reaction for a session run

PUT /api/v1/sessions/{sessionId}/runs/{runId}/feedback

Required scopes: sessions:write.

Source

pub fn stream_session_events( &self, session_id: &str, params: &StreamSessionEventsParams, ) -> EventStream

Stream session events (SSE)

GET /api/v1/sessions/{sessionId}/events

Required scopes: events:read.

Returns a server-sent event stream.

Source

pub async fn update( &self, session_id: &str, body: &UpdateSessionRequest, ) -> Result<Session>

Update session metadata

PUT /api/v1/sessions/{sessionId}

Required scopes: sessions:write.

Source

pub async fn update_session_annotation( &self, session_id: &str, annotation_id: &str, body: &UpdateSessionAnnotationRequest, ) -> Result<Value>

Update annotation (e.g. resolve)

PATCH /api/v1/sessions/{sessionId}/annotations/{annotationId}

Required scopes: sessions:write.

Source

pub async fn update_session_todo( &self, session_id: &str, todo_id: &str, body: &Map<String, Value>, ) -> Result<Todo>

Update a todo

PATCH /api/v1/sessions/{sessionId}/todos/{todoId}

Required scopes: sessions:write.

Trait Implementations§

Source§

impl Clone for SessionsApi

Source§

fn clone(&self) -> SessionsApi

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SessionsApi

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more