Rooms Service¶
The Rooms service manages group chat rooms. You can create rooms, add or remove members, and control member roles using affiliations.
// Access via client
final rooms = client.rooms;
Member Affiliations¶
Affiliation |
Description |
|---|---|
|
Full control over the room |
|
Can manage members and settings |
|
Standard member (default) |
|
No affiliation (used to remove) |
Methods¶
list¶
List all rooms the current user belongs to.
Signature
Future<Map<String, dynamic>> list()
Example
final result = await client.rooms.list();
final rooms = result['rooms'];
create¶
Create a new group chat room.
Signature
Future<Map<String, dynamic>> create({
String? name,
String? title,
String description = '',
String avatarUrl = '',
})
Parameters
Parameter |
Type |
Description |
|---|---|---|
|
String? |
Unique room identifier (e.g. |
|
String? |
Display title for the room. Required if |
|
String |
Optional room description |
|
String |
Optional URL for the room avatar image |
Example
await client.rooms.create(
name: 'team-alpha',
title: 'Team Alpha',
description: 'Main communication room for Team Alpha',
);
get¶
Get details and member list for a specific room.
Signature
Future<Map<String, dynamic>> get(String name)
Parameters
Parameter |
Type |
Description |
|---|---|---|
|
String |
The unique room identifier |
Example
final room = await client.rooms.get('team-alpha');
print(room['title']);
print(room['members']);
destroy¶
Permanently delete a room and remove all its members.
Warning
This action is irreversible. All room data will be lost.
Signature
Future<Map<String, dynamic>> destroy(String name)
Parameters
Parameter |
Type |
Description |
|---|---|---|
|
String |
The unique room identifier |
Example
await client.rooms.destroy('team-alpha');
addMember¶
Add a user to a room with a specified affiliation (role).
Signature
Future<Map<String, dynamic>> addMember({
required String name,
required String nxid,
String affiliation = 'member',
})
Parameters
Parameter |
Type |
Description |
|---|---|---|
|
String |
The unique room identifier |
|
String |
The NX identifier of the user to add |
|
String |
Role: |
Example
await client.rooms.addMember(
name: 'team-alpha',
nxid: 'user@nxservice.quantumvision-tech.com',
affiliation: 'member',
);
removeMember¶
Remove a user from a room.
Signature
Future<Map<String, dynamic>> removeMember({
required String name,
required String nxid,
})
Parameters
Parameter |
Type |
Description |
|---|---|---|
|
String |
The unique room identifier |
|
String |
The NX identifier of the user to remove |
Example
await client.rooms.removeMember(
name: 'team-alpha',
nxid: 'user@nxservice.quantumvision-tech.com',
);