ol.trixnity.room

Room operations, state queries, and timeline traversal.

Upstream Mapping

This namespace maps primarily to Trixnity’s RoomService on de.connect2x.trixnity.client.MatrixClient.

The public wrappers here cover three upstream groupings:

  • room mutations such as room creation, invites, messages, and reactions

  • room observation and state operations such as getById, getAll, getAccountData, getState, and getOutbox

  • room-scoped timeline lookup and traversal helpers exposed through the room service and its timeline helpers

Use ol.trixnity.user for UserService APIs and ol.trixnity.notification, ol.trixnity.verification, and ol.trixnity.key for the other non-room service mappings.

create-room

(create-room client opts)

Creates a room and returns a Missionary task that resolves to the new room id.

Supported opts:

| key | description | |------------------|-----------------------------------------| | ::mx/room-name | Explicit room name used during creation |


invite-user

(invite-user client room-id user-id)
(invite-user client room-id user-id opts)

Invites user-id to room-id and returns a Missionary task.

Supported opts:

| key | description |-----|------------- | ::mx/timeout | Maximum time to wait for the invite request |


join-room

(join-room client room-id)
(join-room client room-id opts)

Joins room-id and returns a Missionary task.

Supported opts:

| key | description |-----|------------- | ::mx/timeout | Maximum time to wait for the join request |


forget-room

(forget-room client room-id)
(forget-room client room-id opts)

Forgets room-id locally and returns a Missionary task.

Upstream notes that this is intended for rooms in LEAVE membership.

Supported opts:

| key | description |-----|------------- | ::mx/force | Force forgetting even when the usual upstream preconditions are not met |


send-message

(send-message client room-id message)
(send-message client room-id message opts)

Queues message for room-id and returns a Missionary task of the transaction id.

Supported opts:

| key | description |-----|------------- | ::mx/timeout | Maximum time to wait for the send operation |


send-reaction

(send-reaction client room-id ev key)
(send-reaction client room-id ev key opts)

Sends a reaction to event ev in room-id and returns a Missionary task.


cancel-send-message

(cancel-send-message client room-id transaction-id)

Cancels an outbox message identified by transaction-id and returns a Missionary task.


retry-send-message

(retry-send-message client room-id transaction-id)

Retries an outbox message identified by transaction-id and returns a Missionary task.


get-by-id

(get-by-id client room-id)

Returns a Missionary flow of the room for room-id, or nil when unavailable.


get-all

(get-all client)

Returns a Missionary flow of room flows keyed by room id.


get-all-flat

(get-all-flat client)

Returns a Missionary flow of flattened room snapshots.


current-users-typing

(current-users-typing client)

Returns the current typing-state snapshot keyed by room id.


users-typing

(users-typing client)

Returns a relieved Missionary flow of typing-state snapshots keyed by room id.


get-account-data

(get-account-data client room-id event-content-class)
(get-account-data client room-id event-content-class key)

Returns a Missionary flow of room account-data content.

When key is omitted, the empty-string key is used.


get-state

(get-state client room-id event-content-class)
(get-state client room-id event-content-class state-key)

Returns a Missionary flow of room state for event-content-class.

When state-key is omitted, the empty-string state key is used.


get-all-state

(get-all-state client room-id event-content-class)

Returns a Missionary flow of state-event flows keyed by state key.


get-outbox

(get-outbox client)
(get-outbox client room-id)
(get-outbox client room-id transaction-id)

Returns Missionary flows over room outbox state.

Arities:

  • (get-outbox client) returns all outbox entries as a list of inner flows

  • (get-outbox client room-id) scopes that list to one room

  • (get-outbox client room-id transaction-id) returns the single outbox entry flow for that transaction id


get-outbox-flat

(get-outbox-flat client)
(get-outbox-flat client room-id)

Returns flattened Missionary flows over room outbox state.

With room-id, scopes the flattened outbox view to a single room.


fill-timeline-gaps

(fill-timeline-gaps client room-id event-id)
(fill-timeline-gaps client room-id event-id opts)

Fills timeline gaps around event-id in room-id and returns a Missionary task.

Supported opts:

| key | description |-----|------------- | ::mx/limit | Maximum number of events to request while filling gaps (default 20) |


get-timeline-event

(get-timeline-event client room-id event-id)
(get-timeline-event client room-id event-id opts)

Returns a Missionary flow of the timeline event for event-id.

Upstream notes that this lookup may traverse locally stored events and fill remote gaps when the event is not available locally.

Supported opts:

| key | description |-----|------------- | ::mx/decryption-timeout | Timeout used while decrypting timeline events | ::mx/fetch-timeout | Timeout for remote fetches when the event is missing locally | ::mx/fetch-size | Maximum number of events fetched from the server at once | ::mx/allow-replace-content | Replace event content when an m.replace relation is present |


get-previous-timeline-event

(get-previous-timeline-event client timeline-event)
(get-previous-timeline-event client timeline-event opts)

Returns a Missionary flow of the previous timeline event relative to timeline-event.

Returns nil when upstream cannot traverse backward from the supplied event.


get-next-timeline-event

(get-next-timeline-event client timeline-event)
(get-next-timeline-event client timeline-event opts)

Returns a Missionary flow of the next timeline event relative to timeline-event.

Returns nil when upstream cannot traverse forward from the supplied event.


get-last-timeline-event

(get-last-timeline-event client room-id)
(get-last-timeline-event client room-id opts)

Returns a Missionary outer flow whose values are flows of the latest timeline event.


get-timeline-events

(get-timeline-events client response)
(get-timeline-events client response opts)
(get-timeline-events client room-id start-from direction)
(get-timeline-events client room-id start-from direction opts)

Returns Missionary flows over timeline events.

Arities:

  • (get-timeline-events client response opts) extracts timeline events from a sync response

  • (get-timeline-events client room-id start-from direction opts) traverses a room timeline from start-from in :backwards or :forwards

The room traversal arity follows upstream behavior: it emits flows of events, may fetch missing events from the server, and can be bounded with ::mx/min-size and ::mx/max-size.


get-last-timeline-events

(get-last-timeline-events client room-id)
(get-last-timeline-events client room-id opts)

Returns a Missionary flow whose values are flows of flows for the latest timeline events.

This mirrors upstream’s nested-flow shape for continuously updated room-end traversal.


get-timeline-events-list

(get-timeline-events-list client room-id start-from direction max-size min-size)
(get-timeline-events-list client room-id start-from direction max-size min-size opts)

Returns a Missionary flow of timeline-event lists starting from start-from.

max-size and min-size bound the list-shaped traversal directly.


get-last-timeline-events-list

(get-last-timeline-events-list client room-id max-size min-size)
(get-last-timeline-events-list client room-id max-size min-size opts)

Returns a Missionary flow of the latest timeline events as lists.


get-timeline-events-around

(get-timeline-events-around client room-id start-from max-size-before max-size-after)
(get-timeline-events-around client room-id start-from max-size-before max-size-after opts)

Returns a Missionary flow of timeline-event lists centered around start-from.


get-timeline-events-from-now-on

(get-timeline-events-from-now-on client)
(get-timeline-events-from-now-on client opts)

Returns a Missionary flow of timeline events received after subscription starts.

Upstream notes that timeline gaps are not filled automatically for this live stream.

Supported opts:

| key | description |-----|------------- | ::mx/decryption-timeout | Timeout used while decrypting live events | ::mx/sync-response-buffer-size | Number of sync responses buffered while events are consumed |


get-timeline-event-relations

(get-timeline-event-relations client room-id event-id relation-type)

Returns a Missionary flow of related timeline-event flows keyed by related event id.