about summary refs log tree commit diff
path: root/LibMatrix.EventTypes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--LibMatrix.EventTypes/Common/MjolnirShortcodeEventContent.cs (renamed from LibMatrix/EventTypes/Common/MjolnirShortcodeEventContent.cs)1
-rw-r--r--LibMatrix.EventTypes/Common/RoomEmotesEventContent.cs (renamed from LibMatrix/EventTypes/Common/RoomEmotesEventContent.cs)5
-rw-r--r--LibMatrix.EventTypes/EventContent.cs (renamed from LibMatrix/Interfaces/EventContent.cs)16
-rw-r--r--LibMatrix.EventTypes/LibMatrix.EventTypes.csproj9
-rw-r--r--LibMatrix.EventTypes/MatrixEventAttribute.cs (renamed from LibMatrix/EventTypes/MatrixEventAttribute.cs)2
-rw-r--r--LibMatrix.EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs (renamed from LibMatrix/EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs)3
-rw-r--r--LibMatrix.EventTypes/Spec/Ephemeral/RoomTypingEventContent.cs (renamed from LibMatrix/EventTypes/Spec/Ephemeral/RoomTypingEventContent.cs)1
-rw-r--r--LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs (renamed from LibMatrix/EventTypes/Spec/RoomMessageEventContent.cs)5
-rw-r--r--LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs)3
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs)3
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs)3
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs)1
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs)1
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs)1
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs)4
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs)3
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs52
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs)3
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs)1
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs)1
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs)11
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs)5
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs)1
-rw-r--r--LibMatrix.EventTypes/Spec/State/Space/SpaceChildEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/Space/SpaceChildEventContent.cs)1
-rw-r--r--LibMatrix.EventTypes/Spec/State/Space/SpaceParentEventContent.cs (renamed from LibMatrix/EventTypes/Spec/State/Space/SpaceParentEventContent.cs)1
25 files changed, 89 insertions, 48 deletions
diff --git a/LibMatrix/EventTypes/Common/MjolnirShortcodeEventContent.cs b/LibMatrix.EventTypes/Common/MjolnirShortcodeEventContent.cs
index a09a393..7924a33 100644
--- a/LibMatrix/EventTypes/Common/MjolnirShortcodeEventContent.cs
+++ b/LibMatrix.EventTypes/Common/MjolnirShortcodeEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Common;
 
diff --git a/LibMatrix/EventTypes/Common/RoomEmotesEventContent.cs b/LibMatrix.EventTypes/Common/RoomEmotesEventContent.cs
index 8d05a2e..bfe480e 100644
--- a/LibMatrix/EventTypes/Common/RoomEmotesEventContent.cs
+++ b/LibMatrix.EventTypes/Common/RoomEmotesEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Common;
 
@@ -19,7 +18,5 @@ public class RoomEmotesEventContent : TimelineEventContent {
         public string? Url { get; set; }
     }
 
-    public class PackInfo {
-
-    }
+    public class PackInfo; // TODO: Implement this
 }
diff --git a/LibMatrix/Interfaces/EventContent.cs b/LibMatrix.EventTypes/EventContent.cs
index 76419a6..608550f 100644
--- a/LibMatrix/Interfaces/EventContent.cs
+++ b/LibMatrix.EventTypes/EventContent.cs
@@ -2,9 +2,11 @@ using System.Text.Json;
 using System.Text.Json.Nodes;
 using System.Text.Json.Serialization;
 
-namespace LibMatrix.Interfaces;
+namespace LibMatrix.EventTypes;
 
-public abstract class EventContent { }
+public abstract class EventContent;
+
+public class UnknownEventContent : TimelineEventContent;
 
 public abstract class TimelineEventContent : EventContent {
     [JsonPropertyName("m.relates_to")]
@@ -14,9 +16,9 @@ public abstract class TimelineEventContent : EventContent {
     public JsonObject? NewContent { get; set; }
 
     public TimelineEventContent SetReplaceRelation(string eventId) {
-        NewContent = JsonSerializer.SerializeToNode(this, GetType()).AsObject();
+        NewContent = JsonSerializer.SerializeToNode(this, GetType())!.AsObject();
         // NewContent = JsonSerializer.Deserialize(jsonText, GetType());
-        RelatesTo = new() {
+        RelatesTo = new MessageRelatesTo {
             RelationType = "m.replace",
             EventId = eventId
         };
@@ -39,10 +41,10 @@ public abstract class TimelineEventContent : EventContent {
 
         public class EventInReplyTo {
             [JsonPropertyName("event_id")]
-            public string EventId { get; set; }
+            public string? EventId { get; set; }
 
             [JsonPropertyName("rel_type")]
-            public string RelType { get; set; }
+            public string? RelType { get; set; }
         }
     }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix.EventTypes/LibMatrix.EventTypes.csproj b/LibMatrix.EventTypes/LibMatrix.EventTypes.csproj
new file mode 100644
index 0000000..3a63532
--- /dev/null
+++ b/LibMatrix.EventTypes/LibMatrix.EventTypes.csproj
@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+    <PropertyGroup>
+        <TargetFramework>net8.0</TargetFramework>
+        <ImplicitUsings>enable</ImplicitUsings>
+        <Nullable>enable</Nullable>
+    </PropertyGroup>
+
+</Project>
diff --git a/LibMatrix/EventTypes/MatrixEventAttribute.cs b/LibMatrix.EventTypes/MatrixEventAttribute.cs
index 92334d0..baa88ff 100644
--- a/LibMatrix/EventTypes/MatrixEventAttribute.cs
+++ b/LibMatrix.EventTypes/MatrixEventAttribute.cs
@@ -2,6 +2,6 @@ namespace LibMatrix.EventTypes;
 
 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
 public class MatrixEventAttribute : Attribute {
-    public string EventName { get; set; }
+    public required string EventName { get; set; }
     public bool Legacy { get; set; }
 }
diff --git a/LibMatrix/EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs b/LibMatrix.EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs
index 8ffbca5..1e98e12 100644
--- a/LibMatrix/EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/Ephemeral/PresenceStateEventContent.cs
@@ -1,7 +1,6 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
-namespace LibMatrix.EventTypes.Spec.State;
+namespace LibMatrix.EventTypes.Spec.Ephemeral;
 
 [MatrixEvent(EventName = EventId)]
 public class PresenceEventContent : EventContent {
diff --git a/LibMatrix/EventTypes/Spec/Ephemeral/RoomTypingEventContent.cs b/LibMatrix.EventTypes/Spec/Ephemeral/RoomTypingEventContent.cs
index b947096..b62b448 100644
--- a/LibMatrix/EventTypes/Spec/Ephemeral/RoomTypingEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/Ephemeral/RoomTypingEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
diff --git a/LibMatrix/EventTypes/Spec/RoomMessageEventContent.cs b/LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs
index 944ed99..1e27bce 100644
--- a/LibMatrix/EventTypes/Spec/RoomMessageEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec;
 
@@ -7,9 +6,9 @@ namespace LibMatrix.EventTypes.Spec;
 public class RoomMessageEventContent : TimelineEventContent {
     public const string EventId = "m.room.message";
 
-    public RoomMessageEventContent(string? messageType = "m.notice", string? body = null) {
+    public RoomMessageEventContent(string messageType = "m.notice", string? body = null) {
         MessageType = messageType;
-        Body = body;
+        Body = body ?? "";
     }
 
     [JsonPropertyName("body")]
diff --git a/LibMatrix/EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs b/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs
index 80d87d6..d3ab8cb 100644
--- a/LibMatrix/EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs
@@ -1,7 +1,6 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
-namespace LibMatrix.EventTypes.Spec.State;
+namespace LibMatrix.EventTypes.Spec.State.Policy;
 
 //spec
 [MatrixEvent(EventName = EventId)] //spec
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs
index 830386d..53b85b8 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs
@@ -1,7 +1,6 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
-namespace LibMatrix.EventTypes.Spec.State;
+namespace LibMatrix.EventTypes.Spec.State.RoomInfo;
 
 [MatrixEvent(EventName = EventId)]
 public class RoomAliasEventContent : TimelineEventContent {
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs
index 9c208ba..d15e88e 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs
@@ -1,7 +1,6 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
-namespace LibMatrix.EventTypes.Spec.State;
+namespace LibMatrix.EventTypes.Spec.State.RoomInfo;
 
 [MatrixEvent(EventName = EventId)]
 public class RoomAvatarEventContent : TimelineEventContent {
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs
index 5ba253c..265775e 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs
index 41145de..7d25dc7 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs
index a3627f2..8e9e05f 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs
index 5bad649..30f2def 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs
@@ -1,13 +1,13 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
 [MatrixEvent(EventName = "m.room.guest_access")]
 public class RoomGuestAccessEventContent : TimelineEventContent {
     [JsonPropertyName("guest_access")]
-    public string GuestAccess { get; set; }
+    public required string GuestAccess { get; set; }
 
+    [JsonIgnore]
     public bool IsGuestAccessEnabled {
         get => GuestAccess == "can_join";
         set => GuestAccess = value ? "can_join" : "forbidden";
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs
index 8f5c7f1..26d40e1 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs
@@ -1,10 +1,9 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
 [MatrixEvent(EventName = "m.room.history_visibility")]
 public class RoomHistoryVisibilityEventContent : TimelineEventContent {
     [JsonPropertyName("history_visibility")]
-    public string HistoryVisibility { get; set; }
+    public required string HistoryVisibility { get; set; }
 }
diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs
new file mode 100644
index 0000000..e300b5d
--- /dev/null
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs
@@ -0,0 +1,52 @@
+using System.Text.Json.Serialization;
+
+namespace LibMatrix.EventTypes.Spec.State;
+
+[MatrixEvent(EventName = "m.room.join_rules")]
+public class RoomJoinRulesEventContent : TimelineEventContent {
+    /// <summary>
+    /// one of ["public", "invite", "knock", "restricted", "knock_restricted"]
+    /// "private" is reserved without implementation!
+    /// </summary>
+    [JsonPropertyName("join_rule")]
+    public string JoinRuleValue { get; set; }
+    
+    [JsonIgnore]
+    public required JoinRules JoinRule {
+        get => JoinRuleValue switch {
+            "public" => JoinRules.Public,
+            "invite" => JoinRules.Invite,
+            "knock" => JoinRules.Knock,
+            "restricted" => JoinRules.Restricted,
+            "knock_restricted" => JoinRules.KnockRestricted,
+            _ => throw new ArgumentOutOfRangeException()
+        };
+        set => JoinRuleValue = value switch {
+            JoinRules.Public => "public",
+            JoinRules.Invite => "invite",
+            JoinRules.Knock => "knock",
+            JoinRules.Restricted => "restricted",
+            JoinRules.KnockRestricted => "knock_restricted",
+            _ => throw new ArgumentOutOfRangeException(nameof(value), value, null)
+        };
+    }
+
+    [JsonPropertyName("allow")]
+    public List<AllowEntry>? Allow { get; set; }
+
+    public class AllowEntry {
+        [JsonPropertyName("type")]
+        public required string Type { get; set; }
+
+        [JsonPropertyName("room_id")]
+        public required string RoomId { get; set; }
+    }
+
+    public enum JoinRules {
+        Public,
+        Invite,
+        Knock,
+        Restricted,
+        KnockRestricted
+    }
+}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs
index 698315e..7e4f9b6 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
@@ -11,7 +10,7 @@ public class RoomMemberEventContent : TimelineEventContent {
     public string? Reason { get; set; }
 
     [JsonPropertyName("membership")]
-    public string Membership { get; set; } = null!;
+    public required string Membership { get; set; }
 
     [JsonPropertyName("displayname")]
     public string? DisplayName { get; set; }
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs
index 9ad67eb..00a1e8f 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs
index 11fe208..9bbcd90 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs
index 08f8ad5..1a09ab8 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
@@ -48,22 +47,22 @@ public class RoomPowerLevelEventContent : TimelineEventContent {
     }
 
     public bool IsUserAdmin(string userId) {
-        if (userId is null) throw new ArgumentNullException(nameof(userId));
+        ArgumentNullException.ThrowIfNull(userId);
         return Users.TryGetValue(userId, out var level) && level >= Events.Max(x => x.Value);
     }
 
     public bool UserHasTimelinePermission(string userId, string eventType) {
-        if (userId is null) throw new ArgumentNullException(nameof(userId));
+        ArgumentNullException.ThrowIfNull(userId);
         return Users.TryGetValue(userId, out var level) && level >= Events.GetValueOrDefault(eventType, EventsDefault ?? 0);
     }
 
     public bool UserHasStatePermission(string userId, string eventType) {
-        if (userId is null) throw new ArgumentNullException(nameof(userId));
+        ArgumentNullException.ThrowIfNull(userId);
         return Users.TryGetValue(userId, out var level) && level >= Events.GetValueOrDefault(eventType, StateDefault ?? 50);
     }
 
     public long GetUserPowerLevel(string userId) {
-        if (userId is null) throw new ArgumentNullException(nameof(userId));
+        ArgumentNullException.ThrowIfNull(userId);
         return Users.TryGetValue(userId, out var level) ? level : UsersDefault ?? UsersDefault ?? 0;
     }
 
@@ -72,7 +71,7 @@ public class RoomPowerLevelEventContent : TimelineEventContent {
     }
 
     public void SetUserPowerLevel(string userId, long powerLevel) {
-        if (userId is null) throw new ArgumentNullException(nameof(userId));
+        ArgumentNullException.ThrowIfNull(userId);
         Users ??= new();
         Users[userId] = powerLevel;
     }
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs
index cbd2241..75337f5 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs
@@ -1,15 +1,14 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
 [MatrixEvent(EventName = "m.room.server_acl")]
 public class RoomServerACLEventContent : TimelineEventContent {
     [JsonPropertyName("allow")]
-    public List<string> Allow { get; set; } // = null!;
+    public List<string>? Allow { get; set; } // = null!;
 
     [JsonPropertyName("deny")]
-    public List<string> Deny { get; set; } // = null!;
+    public List<string>? Deny { get; set; } // = null!;
 
     [JsonPropertyName("allow_ip_literals")]
     public bool AllowIpLiterals { get; set; } // = false;
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs
index 866eecf..3121c39 100644
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
diff --git a/LibMatrix/EventTypes/Spec/State/Space/SpaceChildEventContent.cs b/LibMatrix.EventTypes/Spec/State/Space/SpaceChildEventContent.cs
index 82f4b7f..fb5c938 100644
--- a/LibMatrix/EventTypes/Spec/State/Space/SpaceChildEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/Space/SpaceChildEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;
 
diff --git a/LibMatrix/EventTypes/Spec/State/Space/SpaceParentEventContent.cs b/LibMatrix.EventTypes/Spec/State/Space/SpaceParentEventContent.cs
index 887e91c..0c23298 100644
--- a/LibMatrix/EventTypes/Spec/State/Space/SpaceParentEventContent.cs
+++ b/LibMatrix.EventTypes/Spec/State/Space/SpaceParentEventContent.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.EventTypes.Spec.State;