Expand description
Shared API types for opensession.io
This crate is the single source of truth for all API request/response types.
TypeScript types are auto-generated via ts-rs and consumed by the frontend.
To regenerate TypeScript types: cargo test -p opensession-api-types – export_typescript –nocapture
Modules§
- oauth
- Generic OAuth2 provider support.
Structs§
- Accept
Invitation Response - Returned by
POST /api/invitations/:id/accept— confirms team join. - AddMember
Request - Request body for
POST /api/teams/:id/members— add a member by nickname. - Agent
- AI agent information
- ApiError
- Legacy JSON error shape
{ "error": "..." }returned by all error responses. - Auth
Register Request - Email + password registration.
- Auth
Token Response - Returned on successful login / register / refresh.
- Change
Password Request - Change password request.
- Config
Sync Response - Team-level configuration synced to CLI clients.
- Content
- Multimodal content container
- Create
Team Request - Request body for
POST /api/teams— create a new team. - Event
- A single event in the flat timeline
- Health
Response - Returned by
GET /api/health— server liveness check. - Invitation
Response - Single invitation record returned by list and detail endpoints.
- Invite
Request - Request body for
POST /api/teams/:id/invite— invite a user by email or OAuth identity. - List
Invitations Response - Returned by
GET /api/invitations— pending invitations for the current user. - List
Members Response - Returned by
GET /api/teams/:id/members. - List
Teams Response - Returned by
GET /api/teams— teams the authenticated user belongs to. - Login
Request - Email + password login.
- Logout
Request - Logout request (invalidate refresh token).
- Member
Response - Single team member record.
- OAuth
Link Response - Response for OAuth link initiation (redirect URL).
- OkResponse
- Generic success response for operations that don’t return data.
- Refresh
Request - Refresh token request.
- Regenerate
KeyResponse - Response for API key regeneration.
- Register
Request - Legacy register (nickname-only). Kept for backward compatibility with CLI.
- Register
Response - Returned on successful legacy register (nickname-only, CLI-compatible).
- Session
- Top-level session - the root of a HAIL (Human AI Interaction Log) trace
- Session
Context - Session context metadata
- Session
Detail - Single session detail returned by
GET /api/sessions/:id. - Session
Link - A link between two sessions (e.g., handoff chain).
- Session
List Query - Query parameters for
GET /api/sessions— pagination, filtering, sorting. - Session
List Response - Paginated session listing returned by
GET /api/sessions. - Session
Summary - Flat session summary returned by list/detail endpoints. This is NOT the full HAIL Session — it’s a DB-derived summary.
- Stats
- Aggregate session statistics
- Stream
Events Request - Request body for
POST /api/sessions/:id/events— append live events. - Stream
Events Response - Returned by
POST /api/sessions/:id/events— number of events accepted. - Sync
Pull Query - Query parameters for
GET /api/sync/pull— cursor-based session sync. - Sync
Pull Response - Returned by
GET /api/sync/pull— paginated session data with cursor. - Synced
Privacy Config - Privacy settings synced from the team — controls what data is recorded.
- Synced
Watcher Config - Watcher toggle settings synced from the team — which tools to monitor.
- Team
Detail Response - Returned by
GET /api/teams/:id— team info with member count and recent sessions. - Team
Response - Single team record returned by list and detail endpoints.
- Team
Stats Query - Query parameters for
GET /api/teams/:id/stats. - Team
Stats Response - Returned by
GET /api/teams/:id/stats— aggregated team statistics. - Team
Stats Totals - Aggregate totals across all sessions in a team.
- Tool
Stats - Per-tool aggregated statistics within a team.
- Update
Team Request - Request body for
PUT /api/teams/:id— partial team update. - Upload
Request - Request body for
POST /api/sessions— upload a recorded session. - Upload
Response - Returned on successful session upload — contains the new session ID and URL.
- User
Settings Response - Full user profile returned by
GET /api/auth/me. - User
Stats - Per-user aggregated statistics within a team.
- Verify
Response - Returned by
POST /api/auth/verify— confirms token validity.
Enums§
- Content
Block - Individual content block
- Event
Type - Event type - the core abstraction
- Service
Error - Framework-agnostic service error.