pub struct SessionsApi { /* private fields */ }Expand description
Conversation sessions
Implementations§
Source§impl SessionsApi
impl SessionsApi
Sourcepub async fn activate_session_branch(
&self,
session_id: &str,
branch_id: &str,
) -> Result<ActivateSessionBranchResponse>
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.
Sourcepub async fn bulk_delete_sessions(
&self,
body: &BulkDeleteSessionsRequest,
) -> Result<BulkDeleteSessionsResponse>
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.
Sourcepub async fn close_session(
&self,
session_id: &str,
) -> Result<CloseSessionResponse>
pub async fn close_session( &self, session_id: &str, ) -> Result<CloseSessionResponse>
Close a session
DELETE /api/v1/sessions/{sessionId}
Required scopes: sessions:write.
Sourcepub async fn confirm_session_todo(
&self,
session_id: &str,
todo_id: &str,
body: &Map<String, Value>,
) -> Result<Todo>
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.
Sourcepub async fn create(&self, body: &CreateSessionRequest) -> Result<Session>
pub async fn create(&self, body: &CreateSessionRequest) -> Result<Session>
Create a session
POST /api/v1/sessions
Required scopes: sessions:write.
Sourcepub async fn create_session_annotation(
&self,
session_id: &str,
body: &CreateSessionAnnotationRequest,
) -> Result<CreateSessionAnnotationResponse>
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.
Sourcepub async fn create_session_branch(
&self,
session_id: &str,
body: &CreateSessionBranchRequest,
) -> Result<SessionBranch>
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.
Create session share link
POST /api/v1/sessions/{sessionId}/share
Required scopes: sessions:write.
Sourcepub async fn create_session_todo(
&self,
session_id: &str,
body: &CreateSessionTodoRequest,
) -> Result<Todo>
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.
Sourcepub async fn create_task(&self, body: &Value) -> Result<Map<String, Value>>
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
Sourcepub async fn delete_session_annotation(
&self,
session_id: &str,
annotation_id: &str,
) -> Result<DeleteSessionAnnotationResponse>
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.
Sourcepub async fn delete_session_todo(
&self,
session_id: &str,
todo_id: &str,
) -> Result<DeleteSessionTodoResponse>
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.
Sourcepub async fn export(
&self,
session_id: &str,
params: &ExportSessionParams,
) -> Result<SessionExport>
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.
Sourcepub async fn get(&self, session_id: &str) -> Result<Session>
pub async fn get(&self, session_id: &str) -> Result<Session>
Get a session
GET /api/v1/sessions/{sessionId}
Required scopes: sessions:read.
Sourcepub async fn get_session_audit_log(
&self,
session_id: &str,
) -> Result<GetSessionAuditLogResponse>
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.
Sourcepub async fn get_session_messages(
&self,
session_id: &str,
) -> Result<GetSessionMessagesResponse>
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.
Sourcepub async fn get_session_run_feedback(
&self,
session_id: &str,
run_id: &str,
params: &GetSessionRunFeedbackParams,
) -> Result<Value>
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.
Get session share link status
GET /api/v1/sessions/{sessionId}/share
Required scopes: sessions:read.
Sourcepub async fn list(
&self,
params: &ListSessionsParams,
) -> Result<ListSessionsResponse>
pub async fn list( &self, params: &ListSessionsParams, ) -> Result<ListSessionsResponse>
List sessions
GET /api/v1/sessions
Required scopes: sessions:read.
Sourcepub fn list_all<'a>(
&'a self,
params: &'a ListSessionsParams,
) -> impl Stream<Item = Result<ListSessionsResponseItem>> + 'a
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.
Sourcepub async fn list_session_annotations(
&self,
session_id: &str,
) -> Result<ListSessionAnnotationsResponse>
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.
Sourcepub async fn list_session_artifacts(
&self,
session_id: &str,
) -> Result<ListSessionArtifactsResponse>
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.
Sourcepub async fn list_session_branches(
&self,
session_id: &str,
) -> Result<ListSessionBranchesResponse>
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.
Sourcepub async fn list_session_todos(
&self,
session_id: &str,
params: &ListSessionTodosParams,
) -> Result<ListSessionTodosResponse>
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.
Sourcepub async fn list_todos(&self) -> Result<ListTodosResponse>
pub async fn list_todos(&self) -> Result<ListTodosResponse>
List all todos across sessions
GET /api/v1/todos
Resolve shared session (no auth)
GET /api/v1/shared/{shareId}
Revoke session share link
DELETE /api/v1/sessions/{sessionId}/share
Required scopes: sessions:write.
Sourcepub async fn run_session_todo_now(
&self,
session_id: &str,
todo_id: &str,
) -> Result<Todo>
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.
Sourcepub async fn send_session_message(
&self,
session_id: &str,
body: &SendSessionMessageRequest,
) -> Result<SendSessionMessageResponse>
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.
Sourcepub async fn set_session_run_feedback(
&self,
session_id: &str,
run_id: &str,
body: &Map<String, Value>,
) -> Result<RunFeedbackSet>
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.
Sourcepub fn stream_session_events(
&self,
session_id: &str,
params: &StreamSessionEventsParams,
) -> EventStream
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.
Sourcepub async fn update(
&self,
session_id: &str,
body: &UpdateSessionRequest,
) -> Result<Session>
pub async fn update( &self, session_id: &str, body: &UpdateSessionRequest, ) -> Result<Session>
Update session metadata
PUT /api/v1/sessions/{sessionId}
Required scopes: sessions:write.
Sourcepub async fn update_session_annotation(
&self,
session_id: &str,
annotation_id: &str,
body: &UpdateSessionAnnotationRequest,
) -> Result<Value>
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.
Trait Implementations§
Source§impl Clone for SessionsApi
impl Clone for SessionsApi
Source§fn clone(&self) -> SessionsApi
fn clone(&self) -> SessionsApi
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more