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 |
|---|---|
|
Optional space name |
|
Optional space topic |
|
Optional users to invite during creation |
|
Optional upstream create-room preset |
|
Optional direct-room flag passed through upstream |
|
Optional directory visibility |
|
Optional upstream power-level content override |
|
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 |
|---|---|
|
Optional subspace name |
|
Optional subspace topic |
|
Optional users to invite during creation |
|
Optional upstream create-room preset |
|
Optional direct-room flag passed through upstream |
|
Optional directory visibility |
|
Optional upstream power-level content override |
|
Required non-empty set of server names for the child relation |
|
Optional Matrix space child ordering string |
|
Optional suggested-child flag |
|
Optional external URL for the child relation |
|
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 |
|---|---|
|
Optional pagination token |
|
Optional maximum rooms per page |
|
Optional maximum traversal depth |
|
When true, include only suggested children |
|
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 |
|---|---|
|
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 |
|---|---|
|
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 |
|---|---|
|
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 |
|---|---|
|
Maximum time to wait for the state event request |