# appendEvent

open suspend override 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.

Note: Implementations of SessionService overriding this method should call `super.appendEvent(session, event)` to ensure that the caller's session object is updated and kept in sync.

This method primarily modifies the passed session object in memory. Persisting these changes typically requires a separate call to an update/save method provided by the specific service implementation, or might happen implicitly depending on the implementation's design.

If the event is marked as partial (e.g., `event.partial == true`), it is returned directly without modifying the session state or event list. State delta keys starting with State.TEMP_PREFIX are ignored during state updates.

#### Return

The appended Event instance (or the original event if it was partial).

#### Parameters

session

The Session object to which the event should be appended (will be mutated).

event

The Event to append.