about summary refs log tree commit diff
path: root/LibMatrix
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2024-02-09 16:30:49 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2024-02-09 16:30:49 +0100
commitf11fe491349854526f8d13e8b62458baeb3b23b6 (patch)
treec1c423d6bce67b2aa235b28daac914e6a7d1a6d9 /LibMatrix
parentAllow specifying chunk size for GetManyMessages (diff)
downloadLibMatrix-f11fe491349854526f8d13e8b62458baeb3b23b6.tar.xz
Consistently use EventId for event types
Diffstat (limited to '')
-rw-r--r--LibMatrix.EventTypes/Common/MjolnirShortcodeEventContent.cs2
-rw-r--r--LibMatrix.EventTypes/Common/RoomEmotesEventContent.cs6
-rw-r--r--LibMatrix.EventTypes/EventContent.cs4
-rw-r--r--LibMatrix.EventTypes/LibMatrix.EventTypes.csproj2
-rw-r--r--LibMatrix.EventTypes/MatrixEventAttribute.cs2
-rw-r--r--LibMatrix.EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs19
-rw-r--r--LibMatrix.EventTypes/Spec/Ephemeral/RoomTypingEventContent.cs2
-rw-r--r--LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs5
-rw-r--r--LibMatrix.EventTypes/Spec/RoomMessageReactionEventContent.cs2
-rw-r--r--LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs18
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs2
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs2
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs2
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs2
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs7
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs5
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs5
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs7
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs2
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs2
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs6
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs8
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs4
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs5
-rw-r--r--LibMatrix.EventTypes/Spec/State/Space/SpaceChildEventContent.cs8
-rw-r--r--LibMatrix.EventTypes/Spec/State/Space/SpaceParentEventContent.cs6
26 files changed, 77 insertions, 58 deletions
diff --git a/LibMatrix.EventTypes/Common/MjolnirShortcodeEventContent.cs b/LibMatrix.EventTypes/Common/MjolnirShortcodeEventContent.cs
index a4974e3..a31cbbb 100644
--- a/LibMatrix.EventTypes/Common/MjolnirShortcodeEventContent.cs
+++ b/LibMatrix.EventTypes/Common/MjolnirShortcodeEventContent.cs
@@ -8,4 +8,4 @@ public class MjolnirShortcodeEventContent : TimelineEventContent {
 
     [JsonPropertyName("shortcode")]
     public string? Shortcode { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Common/RoomEmotesEventContent.cs b/LibMatrix.EventTypes/Common/RoomEmotesEventContent.cs
index bfe480e..b9a837f 100644
--- a/LibMatrix.EventTypes/Common/RoomEmotesEventContent.cs
+++ b/LibMatrix.EventTypes/Common/RoomEmotesEventContent.cs
@@ -2,8 +2,10 @@ using System.Text.Json.Serialization;
 
 namespace LibMatrix.EventTypes.Common;
 
-[MatrixEvent(EventName = "im.ponies.room_emotes")]
+[MatrixEvent(EventName = EventId)]
 public class RoomEmotesEventContent : TimelineEventContent {
+    public const string EventId = "im.ponies.room_emotes";
+
     [JsonPropertyName("emoticons")]
     public Dictionary<string, EmoticonData>? Emoticons { get; set; }
 
@@ -19,4 +21,4 @@ public class RoomEmotesEventContent : TimelineEventContent {
     }
 
     public class PackInfo; // TODO: Implement this
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/EventContent.cs b/LibMatrix.EventTypes/EventContent.cs
index 608550f..c582cf2 100644
--- a/LibMatrix.EventTypes/EventContent.cs
+++ b/LibMatrix.EventTypes/EventContent.cs
@@ -25,9 +25,7 @@ public abstract class TimelineEventContent : EventContent {
         return this;
     }
 
-    public T SetReplaceRelation<T>(string eventId) where T : TimelineEventContent {
-        return SetReplaceRelation(eventId) as T ?? throw new InvalidOperationException();
-    }
+    public T SetReplaceRelation<T>(string eventId) where T : TimelineEventContent => SetReplaceRelation(eventId) as T ?? throw new InvalidOperationException();
 
     public class MessageRelatesTo {
         [JsonPropertyName("m.in_reply_to")]
diff --git a/LibMatrix.EventTypes/LibMatrix.EventTypes.csproj b/LibMatrix.EventTypes/LibMatrix.EventTypes.csproj
index 1c38825..4276003 100644
--- a/LibMatrix.EventTypes/LibMatrix.EventTypes.csproj
+++ b/LibMatrix.EventTypes/LibMatrix.EventTypes.csproj
@@ -5,7 +5,7 @@
         <ImplicitUsings>enable</ImplicitUsings>
         <Nullable>enable</Nullable>
     </PropertyGroup>
-    
+
     <ItemGroup>
         <ProjectReference Condition="Exists('..\ArcaneLibs\ArcaneLibs\ArcaneLibs.csproj')" Include="..\ArcaneLibs\ArcaneLibs\ArcaneLibs.csproj"/>
         <!-- This is dangerous, but eases development since locking the version will drift out of sync without noticing,
diff --git a/LibMatrix.EventTypes/MatrixEventAttribute.cs b/LibMatrix.EventTypes/MatrixEventAttribute.cs
index baa88ff..5f06cec 100644
--- a/LibMatrix.EventTypes/MatrixEventAttribute.cs
+++ b/LibMatrix.EventTypes/MatrixEventAttribute.cs
@@ -4,4 +4,4 @@ namespace LibMatrix.EventTypes;
 public class MatrixEventAttribute : Attribute {
     public required string EventName { get; set; }
     public bool Legacy { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs b/LibMatrix.EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs
index 1e98e12..fc2c355 100644
--- a/LibMatrix.EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs
@@ -6,16 +6,25 @@ namespace LibMatrix.EventTypes.Spec.Ephemeral;
 public class PresenceEventContent : EventContent {
     public const string EventId = "m.presence";
 
-    [JsonPropertyName("presence"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+    [JsonPropertyName("presence")]
+    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
     public string? Presence { get; set; }
+
     [JsonPropertyName("last_active_ago")]
     public long LastActiveAgo { get; set; }
+
     [JsonPropertyName("currently_active")]
     public bool CurrentlyActive { get; set; }
-    [JsonPropertyName("status_msg"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+
+    [JsonPropertyName("status_msg")]
+    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
     public string? StatusMessage { get; set; }
-    [JsonPropertyName("avatar_url"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+
+    [JsonPropertyName("avatar_url")]
+    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
     public string? AvatarUrl { get; set; }
-    [JsonPropertyName("displayname"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+
+    [JsonPropertyName("displayname")]
+    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
     public string? DisplayName { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/Ephemeral/RoomTypingEventContent.cs b/LibMatrix.EventTypes/Spec/Ephemeral/RoomTypingEventContent.cs
index 48739f2..494936d 100644
--- a/LibMatrix.EventTypes/Spec/Ephemeral/RoomTypingEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/Ephemeral/RoomTypingEventContent.cs
@@ -8,4 +8,4 @@ public class RoomTypingEventContent : EventContent {
 
     [JsonPropertyName("user_ids")]
     public string[]? UserIds { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs b/LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs
index 1e27bce..f3e3f4f 100644
--- a/LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs
@@ -37,10 +37,11 @@ public class RoomMessageEventContent : TimelineEventContent {
     public class FileInfoStruct {
         [JsonPropertyName("mimetype")]
         public string? MimeType { get; set; }
+
         [JsonPropertyName("size")]
         public long Size { get; set; }
+
         [JsonPropertyName("thumbnail_url")]
         public string? ThumbnailUrl { get; set; }
     }
-
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/RoomMessageReactionEventContent.cs b/LibMatrix.EventTypes/Spec/RoomMessageReactionEventContent.cs
index 64b4f20..e2c0c8f 100644
--- a/LibMatrix.EventTypes/Spec/RoomMessageReactionEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/RoomMessageReactionEventContent.cs
@@ -3,4 +3,4 @@ namespace LibMatrix.EventTypes.Spec;
 [MatrixEvent(EventName = EventId)]
 public class RoomMessageReactionEventContent : TimelineEventContent {
     public const string EventId = "m.reaction";
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs b/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs
index 5cc5957..6006048 100644
--- a/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs
@@ -29,9 +29,7 @@ public class RoomPolicyRuleEventContent : PolicyRuleEventContent {
 }
 
 public abstract class PolicyRuleEventContent : EventContent {
-    public PolicyRuleEventContent() {
-        Console.WriteLine($"init policy {GetType().Name}");
-    }
+    public PolicyRuleEventContent() => Console.WriteLine($"init policy {GetType().Name}");
     private string? _reason;
 
     /// <summary>
@@ -42,25 +40,23 @@ public abstract class PolicyRuleEventContent : EventContent {
     [FriendlyName(Name = "Entity")]
     public string? Entity { get; set; }
 
-
     private bool init;
+
     /// <summary>
     ///     Reason this user is banned
     /// </summary>
     [JsonPropertyName("reason")]
     [FriendlyName(Name = "Reason")]
     public virtual string? Reason {
-        get {
+        get =>
             // Console.WriteLine($"Read policy reason: {_reason}");
-            return _reason;
-        }
-        set {
+            _reason;
+        set =>
             // Console.WriteLine($"Set policy reason: {value}");
             // if(init)
-                // Console.WriteLine(string.Join('\n', Environment.StackTrace.Split('\n')[..5]));
+            // Console.WriteLine(string.Join('\n', Environment.StackTrace.Split('\n')[..5]));
             // init = true;
             _reason = value;
-        }
     }
 
     /// <summary>
@@ -86,7 +82,7 @@ public abstract class PolicyRuleEventContent : EventContent {
     public DateTime? ExpiryDateTime {
         get => Expiry == null ? null : DateTimeOffset.FromUnixTimeMilliseconds(Expiry.Value).DateTime;
         set {
-            if(value is not null)
+            if (value is not null)
                 Expiry = ((DateTimeOffset)value).ToUnixTimeMilliseconds();
         }
     }
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs
index 14c7cf6..4e82ac1 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs
@@ -8,4 +8,4 @@ public class RoomAliasEventContent : EventContent {
 
     [JsonPropertyName("aliases")]
     public List<string>? Aliases { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs
index 62de70c..c718826 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs
@@ -25,4 +25,4 @@ public class RoomAvatarEventContent : EventContent {
         [JsonPropertyName("size")]
         public int? Size { get; set; }
     }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs
index dd96016..93f13ac 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs
@@ -11,4 +11,4 @@ public class RoomCanonicalAliasEventContent : EventContent {
 
     [JsonPropertyName("alt_aliases")]
     public string[]? AltAliases { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs
index 02867e4..c619d0e 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs
@@ -28,4 +28,4 @@ public class RoomCreateEventContent : EventContent {
         [JsonPropertyName("event_id")]
         public string? EventId { get; set; }
     }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs
index 5ddd7f3..b49abfa 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs
@@ -2,13 +2,16 @@ using System.Text.Json.Serialization;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
-[MatrixEvent(EventName = "m.room.encryption")]
+[MatrixEvent(EventName = EventId)]
 public class RoomEncryptionEventContent : EventContent {
     public const string EventId = "m.room.encryption";
+
     [JsonPropertyName("algorithm")]
     public string? Algorithm { get; set; }
+
     [JsonPropertyName("rotation_period_ms")]
     public ulong? RotationPeriodMs { get; set; }
+
     [JsonPropertyName("rotation_period_msgs")]
     public ulong? RotationPeriodMsgs { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs
index 5e6e4d2..a7811bf 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs
@@ -2,9 +2,10 @@ using System.Text.Json.Serialization;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
-[MatrixEvent(EventName = "m.room.guest_access")]
+[MatrixEvent(EventName = EventId)]
 public class RoomGuestAccessEventContent : EventContent {
     public const string EventId = "m.room.guest_access";
+
     [JsonPropertyName("guest_access")]
     public string GuestAccess { get; set; }
 
@@ -13,4 +14,4 @@ public class RoomGuestAccessEventContent : EventContent {
         get => GuestAccess == "can_join";
         set => GuestAccess = value ? "can_join" : "forbidden";
     }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs
index c523e5e..7676dad 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs
@@ -2,9 +2,10 @@ using System.Text.Json.Serialization;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
-[MatrixEvent(EventName = "m.room.history_visibility")]
+[MatrixEvent(EventName = EventId)]
 public class RoomHistoryVisibilityEventContent : EventContent {
     public const string EventId = "m.room.history_visibility";
+
     [JsonPropertyName("history_visibility")]
     public string HistoryVisibility { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs
index 981d927..b557e47 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs
@@ -2,9 +2,10 @@ using System.Text.Json.Serialization;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
-[MatrixEvent(EventName = "m.room.join_rules")]
+[MatrixEvent(EventName = EventId)]
 public class RoomJoinRulesEventContent : EventContent {
     public const string EventId = "m.room.join_rules";
+
     /// <summary>
     /// one of ["public", "invite", "knock", "restricted", "knock_restricted"]
     /// "private" is reserved without implementation!
@@ -12,7 +13,7 @@ public class RoomJoinRulesEventContent : EventContent {
     /// </summary>
     [JsonPropertyName("join_rule")]
     public string JoinRuleValue { get; set; }
-    
+
     [JsonIgnore]
     public JoinRules JoinRule {
         get => JoinRuleValue switch {
@@ -52,4 +53,4 @@ public class RoomJoinRulesEventContent : EventContent {
         KnockRestricted,
         Private // reserved without implementation!
     }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs
index 1a64f40..31983e0 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs
@@ -26,4 +26,4 @@ public class RoomMemberEventContent : EventContent {
 
     [JsonPropertyName("join_authorised_via_users_server")]
     public string? JoinAuthorisedViaUsersServer { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs
index 1c4513b..3ea5730 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs
@@ -8,4 +8,4 @@ public class RoomNameEventContent : EventContent {
 
     [JsonPropertyName("name")]
     public string? Name { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs
index b033d82..b4474e9 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs
@@ -2,8 +2,10 @@ using System.Text.Json.Serialization;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
-[MatrixEvent(EventName = "m.room.pinned_events")]
+[MatrixEvent(EventName = EventId)]
 public class RoomPinnedEventContent : EventContent {
+    public const string EventId = "m.room.pinned_events";
+
     [JsonPropertyName("pinned")]
     public string[]? PinnedEvents { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs
index 325a10e..cb9ebb7 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs
@@ -67,13 +67,11 @@ public class RoomPowerLevelEventContent : EventContent {
         return Users.TryGetValue(userId, out var level) ? level : UsersDefault ?? UsersDefault ?? 0;
     }
 
-    public long GetEventPowerLevel(string eventType) {
-        return Events.TryGetValue(eventType, out var level) ? level : EventsDefault ?? EventsDefault ?? 0;
-    }
+    public long GetEventPowerLevel(string eventType) => Events.TryGetValue(eventType, out var level) ? level : EventsDefault ?? EventsDefault ?? 0;
 
     public void SetUserPowerLevel(string userId, long powerLevel) {
         ArgumentNullException.ThrowIfNull(userId);
-        Users ??= new();
+        Users ??= new Dictionary<string, long>();
         Users[userId] = powerLevel;
     }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs
index b720b14..be83e37 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
-[MatrixEvent(EventName = "m.room.server_acl")]
+[MatrixEvent(EventName = EventId)]
 public class RoomServerACLEventContent : EventContent {
     public const string EventId = "m.room.server_acl";
 
@@ -14,4 +14,4 @@ public class RoomServerACLEventContent : EventContent {
 
     [JsonPropertyName("allow_ip_literals")]
     public bool AllowIpLiterals { get; set; } // = false;
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs
index 8abb2c8..92fa75d 100644
--- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs
@@ -2,10 +2,11 @@ using System.Text.Json.Serialization;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
-[MatrixEvent(EventName = "m.room.topic")]
+[MatrixEvent(EventName = EventId)]
 [MatrixEvent(EventName = "org.matrix.msc3765.topic", Legacy = true)]
 public class RoomTopicEventContent : EventContent {
     public const string EventId = "m.room.topic";
+
     [JsonPropertyName("topic")]
     public string? Topic { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/Space/SpaceChildEventContent.cs b/LibMatrix.EventTypes/Spec/State/Space/SpaceChildEventContent.cs
index 2caa791..d233be4 100644
--- a/LibMatrix.EventTypes/Spec/State/Space/SpaceChildEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/Space/SpaceChildEventContent.cs
@@ -2,12 +2,16 @@ using System.Text.Json.Serialization;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
-[MatrixEvent(EventName = "m.space.child")]
+[MatrixEvent(EventName = EventId)]
 public class SpaceChildEventContent : EventContent {
+    public const string EventId = "m.space.child";
+
     [JsonPropertyName("auto_join")]
     public bool? AutoJoin { get; set; }
+
     [JsonPropertyName("via")]
     public List<string>? Via { get; set; }
+
     [JsonPropertyName("suggested")]
     public bool? Suggested { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/Spec/State/Space/SpaceParentEventContent.cs b/LibMatrix.EventTypes/Spec/State/Space/SpaceParentEventContent.cs
index 180f4b7..2ab79a4 100644
--- a/LibMatrix.EventTypes/Spec/State/Space/SpaceParentEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/Space/SpaceParentEventContent.cs
@@ -2,11 +2,13 @@ using System.Text.Json.Serialization;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
-[MatrixEvent(EventName = "m.space.parent")]
+[MatrixEvent(EventName = EventId)]
 public class SpaceParentEventContent : EventContent {
+    public const string EventId = "m.space.parent";
+
     [JsonPropertyName("via")]
     public string[]? Via { get; set; }
 
     [JsonPropertyName("canonical")]
     public bool? Canonical { get; set; }
-}
+}
\ No newline at end of file