patchPreferences abstract method
Updates the current user's private room preferences in a single request and returns the merged server-side state.
All preferences are per-user: they only affect the calling user and are invisible to other members. Pass only the fields you want to change — omitted parameters are left untouched server-side.
muted—trueto silence notifications,falseto unmute. For a timed mute passmuteUntilinstead (which impliesmuted: true).muteUntil— mute only until that instant (WhatsApp-style 8h / 1 week timed mutes). Sent as an ISO-8601 string; the backend derivesmutedby comparing it with the current time. Mutually exclusive with an explicitmutedvalue.pinned—trueto pin the room to the top of the list.hidden—trueto hide (archive) the room from getUserRooms.
On success the roomDetail:<roomId>, rooms:all, and rooms:unread
TTL keys are invalidated so the next read reflects the change.
This is the canonical preferences endpoint; mute, unmute, pin,
unpin, hide, and unhide are thin wrappers that delegate here.
final res = await client.rooms.patchPreferences(
roomId,
pinned: true,
hidden: false,
);
switch (res) {
case ChatSuccess(:final data): print(data.pinned); // true
case ChatFailureResult(:final failure): showError(failure);
}
Implementation
Future<ChatResult<RoomPreferences>> patchPreferences(
String roomId, {
bool? muted,
DateTime? muteUntil,
bool? pinned,
bool? hidden,
});