# SessionService

interface SessionService

Defines the contract for managing Sessions and their associated Events. Provides methods for creating, retrieving, listing, and deleting sessions, as well as listing and appending events to a session. Implementations of this interface handle the underlying storage and retrieval logic.

#### Inheritors

InMemorySessionService

## Functions

appendEvent
Link copied to clipboard
open suspend fun appendEvent(session: Session, event: Event): Event

Appends an event to an in-memory session object and updates the session's state based on the event's state delta, if applicable.

closeSession
Link copied to clipboard
open suspend fun closeSession(session: Session)

Closes a session.

createSession
Link copied to clipboard
abstract suspend fun createSession(key: SessionKey, state: Map<String, Any>? = null): Session

Creates a new session with the specified parameters.

deleteSession
Link copied to clipboard
abstract suspend fun deleteSession(key: SessionKey)

Deletes a specific session.

getSession
Link copied to clipboard
abstract suspend fun getSession(key: SessionKey, config: GetSessionConfig? = null): Session?

Retrieves a specific session, optionally filtering the events included.

listEvents
Link copied to clipboard
abstract suspend fun listEvents(key: SessionKey): ListEventsResponse

Lists the events within a specific session.

listSessions
Link copied to clipboard
abstract suspend fun listSessions(appName: String, userId: String): ListSessionsResponse

Lists sessions associated with a specific application and user.