ol.trixnity.space

Matrix space creation, hierarchy, and relation helpers.

Spaces are Matrix rooms with room type m.space. This namespace keeps the wrapper thin: optional values are passed only when callers provide them, and parent/child relation state is managed explicitly. Use ol.trixnity.room and ol.trixnity.user for generic room membership and power-level APIs.

create-space

(create-space client)
(create-space client opts)

Creates a Matrix space and returns a Missionary task resolving to its room id.

The request uses upstream create-room defaults and only forces the Matrix room type to m.space. It does not add encryption or relation state.

Supported opts:

key description

::mx/room-name

Optional space name

::mx/topic

Optional space topic

::mx/invite

Optional users to invite during creation

::mx/preset

Optional upstream create-room preset

::mx/is-direct

Optional direct-room flag passed through upstream

::mx/visibility

Optional directory visibility

::mx/power-levels

Optional upstream power-level content override

::mx/timeout

Maximum time to wait for the create request


create-subspace

(create-subspace client parent-space-id opts)

Creates a Matrix space and adds it as a child of parent-space-id.

This composes create-space with set-child. It writes only the m.space.child event in parent-space-id; use set-parent separately if the child should also contain an m.space.parent event.

Supported opts:

key description

::mx/room-name

Optional subspace name

::mx/topic

Optional subspace topic

::mx/invite

Optional users to invite during creation

::mx/preset

Optional upstream create-room preset

::mx/is-direct

Optional direct-room flag passed through upstream

::mx/visibility

Optional directory visibility

::mx/power-levels

Optional upstream power-level content override

::mx/via

Required non-empty set of server names for the child relation

::mx/order

Optional Matrix space child ordering string

::mx/suggested

Optional suggested-child flag

::mx/external-url

Optional external URL for the child relation

::mx/timeout

Maximum time to wait for each request


hierarchy

(hierarchy client space-id)
(hierarchy client space-id opts)

Returns one paginated hierarchy page for space-id as a Missionary task.

Supported opts:

key description

::mx/from

Optional pagination token

::mx/limit

Optional maximum rooms per page

::mx/max-depth

Optional maximum traversal depth

::mx/suggested-only

When true, include only suggested children

::mx/timeout

Maximum time to wait for the hierarchy request


get-all

(get-all client)

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

This observes spaces already known to the client. It does not perform public room discovery.


get-all-flat

(get-all-flat client)

Returns a Missionary flow of local flattened space snapshots.

This observes spaces already known to the client. It does not perform public room discovery.


get-children

(get-children client space-id)

Returns a Missionary flow of m.space.child state flows keyed by child room id.


get-child

(get-child client space-id child-room-id)

Returns a Missionary flow of the child relation for child-room-id.


get-parents

(get-parents client room-id)

Returns a Missionary flow of m.space.parent state flows keyed by parent space id.


set-child

(set-child client space-id child-room-id content)
(set-child client space-id child-room-id content opts)

Writes an m.space.child event in space-id for child-room-id.

The content map must include ::mx/via. It may also include ::mx/order, ::mx/suggested, and ::mx/external-url.

Supported opts:

key description

::mx/timeout

Maximum time to wait for the state event request


remove-child

(remove-child client space-id child-room-id)
(remove-child client space-id child-room-id opts)

Removes the child relation from space-id to child-room-id.

This sends empty m.space.child content for the child state key, which makes the relation invalid under Matrix space rules.

Supported opts:

key description

::mx/timeout

Maximum time to wait for the state event request


set-parent

(set-parent client room-id parent-space-id content)
(set-parent client room-id parent-space-id content opts)

Writes an m.space.parent event in room-id for parent-space-id.

The content map must include ::mx/via. It may also include ::mx/canonical and ::mx/external-url.

Supported opts:

key description

::mx/timeout

Maximum time to wait for the state event request


remove-parent

(remove-parent client room-id parent-space-id)
(remove-parent client room-id parent-space-id opts)

Removes the parent relation from room-id to parent-space-id.

This sends empty m.space.parent content for the parent state key, which makes the relation invalid under Matrix space rules.

Supported opts:

key description

::mx/timeout

Maximum time to wait for the state event request