about summary refs log tree commit diff
path: root/LibMatrix/Responses/CreateRoomRequest.cs
diff options
context:
space:
mode:
Diffstat (limited to 'LibMatrix/Responses/CreateRoomRequest.cs')
-rw-r--r--LibMatrix/Responses/CreateRoomRequest.cs21
1 files changed, 12 insertions, 9 deletions
diff --git a/LibMatrix/Responses/CreateRoomRequest.cs b/LibMatrix/Responses/CreateRoomRequest.cs

index d9a6acd..b4dcc78 100644 --- a/LibMatrix/Responses/CreateRoomRequest.cs +++ b/LibMatrix/Responses/CreateRoomRequest.cs
@@ -29,7 +29,7 @@ public class CreateRoomRequest { // public string Preset { get; set; } [JsonPropertyName("initial_state")] - public List<StateEvent>? InitialState { get; set; } + public List<MatrixEvent>? InitialState { get; set; } /// <summary> /// One of: ["public", "private"] @@ -42,24 +42,27 @@ public class CreateRoomRequest { public RoomPowerLevelEventContent? PowerLevelContentOverride { get; set; } [JsonPropertyName("creation_content")] - public JsonObject CreationContent { get; set; } = new(); + public Dictionary<string, object> CreationContent { get; set; } = new(); [JsonPropertyName("invite")] public List<string>? Invite { get; set; } + [JsonPropertyName("room_version")] + public string? RoomVersion { get; set; } + /// <summary> /// For use only when you can't use the CreationContent property /// </summary> - public StateEvent? this[string eventType, string eventKey = ""] { + public MatrixEvent? this[string eventType, string eventKey = ""] { get { var stateEvent = InitialState?.FirstOrDefault(x => x.Type == eventType && x.StateKey == eventKey); if (stateEvent == null) - InitialState?.Add(stateEvent = new StateEvent { + InitialState?.Add(stateEvent = new MatrixEvent { Type = eventType, StateKey = eventKey, TypedContent = (EventContent)Activator.CreateInstance( - StateEvent.KnownStateEventTypes.FirstOrDefault(x => + MatrixEvent.KnownEventTypes.FirstOrDefault(x => x.GetCustomAttributes<MatrixEventAttribute>()? .Any(y => y.EventName == eventType) ?? false) ?? typeof(UnknownEventContent) )! @@ -89,7 +92,7 @@ public class CreateRoomRequest { var request = new CreateRoomRequest { Name = name ?? "New public Room", Visibility = "public", - CreationContent = new JsonObject(), + CreationContent = new(), PowerLevelContentOverride = new RoomPowerLevelEventContent { EventsDefault = 0, UsersDefault = 0, @@ -119,7 +122,7 @@ public class CreateRoomRequest { } }, RoomAliasName = roomAliasName, - InitialState = new List<StateEvent>() + InitialState = new List<MatrixEvent>() }; return request; @@ -129,7 +132,7 @@ public class CreateRoomRequest { var request = new CreateRoomRequest { Name = name ?? "New private Room", Visibility = "private", - CreationContent = new JsonObject(), + CreationContent = new(), PowerLevelContentOverride = new RoomPowerLevelEventContent { EventsDefault = 0, UsersDefault = 0, @@ -159,7 +162,7 @@ public class CreateRoomRequest { } }, RoomAliasName = roomAliasName, - InitialState = new List<StateEvent>() + InitialState = new List<MatrixEvent>() }; return request;