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, reactions, and supported room state events and redactions

  • 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.

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, including attachment upload progress under ::mx/media-upload-progress when available


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

Optional room display name.

::mx/topic

Optional room topic.

::mx/invite

Optional vector of Matrix user ids to invite during creation.

::mx/preset

Optional preset keyword, one of :private-chat, :public-chat, or :trusted-private-chat.

::mx/is-direct

Optional direct-message flag for invite membership events.

::mx/visibility

Optional room-directory visibility, either :private or :public.


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-or-alias)
(join-room client room-id-or-alias opts)

Joins room-id-or-alias and returns a Missionary task.

Supported opts:

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


leave-room

(leave-room client room-id)
(leave-room client room-id opts)

Leaves room-id and returns a Missionary task.

Supported opts:

key description

::mx/reason

Optional Matrix leave reason passed through to Trixnity

::mx/timeout

Maximum time to wait for the leave 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 a send handle.

The task resolves to:

  • ::mx/transaction-id for the queued outbox entry

  • ::mx/status, a Missionary flow backed by get-outbox for that transaction id

The status flow may emit nil after the message leaves the outbox, which usually means it was echoed back by sync, cancelled, or otherwise removed.

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.


send-state-event

(send-state-event client room-id state-event)
(send-state-event client room-id state-event opts)

Sends a supported room state event map to room-id.

Supported state-event payloads:

  • {::mx/type "m.room.name", ::mx/name …​}

  • {::mx/type "m.room.topic", ::mx/topic …​}

  • {::mx/type "m.room.avatar", ::mx/url …​}

::mx/state-key is optional on the payload and defaults to the empty string.

Supported opts:

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


redact-event

(redact-event client room-id event-id)
(redact-event client room-id event-id opts)

Redacts event-id in room-id and returns a Missionary task of the redaction event id.

Supported opts:

| key | description |-----|------------- | ::mx/reason | Optional redaction reason sent to the homeserver | | ::mx/timeout | Maximum time to wait for the redact operation |


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.


set-typing

(set-typing client room-id typing?)
(set-typing client room-id typing? opts)

Sets the typing status for room-id and returns a Missionary task.

Supported opts:

key description

::mx/timeout

How long the typing notification should remain active


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-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.

Flattened outbox snapshots also include ::mx/media-upload-progress when an attachment-backed send is still uploading.


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.