Make room type into an enum

This commit is contained in:
Henry Hiles 2026-05-20 10:41:18 -04:00
commit e59505bd6e
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -19,13 +19,19 @@ abstract class CreateContent extends Content with _$CreateContent {
@JsonKey(name: "m.federate") @Default(true) bool federated, @JsonKey(name: "m.federate") @Default(true) bool federated,
@Default("1") String roomVersion, @Default("1") String roomVersion,
String? type, @JsonKey(unknownEnumValue: RoomType.room) RoomType? type,
}) = _CreateContent; }) = _CreateContent;
factory CreateContent.fromJson(Map<String, Object?> json) => factory CreateContent.fromJson(Map<String, Object?> json) =>
_$CreateContentFromJson(json); _$CreateContentFromJson(json);
} }
enum RoomType {
room,
@JsonValue("m.space")
space,
}
@freezed @freezed
abstract class PreviousRoom with _$PreviousRoom { abstract class PreviousRoom with _$PreviousRoom {
const factory PreviousRoom({required String roomId}) = _PreviousRoom; const factory PreviousRoom({required String roomId}) = _PreviousRoom;