about summary refs log tree commit diff
path: root/LibMatrix/Responses
diff options
context:
space:
mode:
Diffstat (limited to 'LibMatrix/Responses')
-rw-r--r--LibMatrix/Responses/Admin/AdminRoomListingResult.cs6
-rw-r--r--LibMatrix/Responses/CreateRoomRequest.cs26
-rw-r--r--LibMatrix/Responses/CreationContentBaseType.cs10
-rw-r--r--LibMatrix/Responses/LoginResponse.cs2
-rw-r--r--LibMatrix/Responses/SyncResponse.cs10
-rw-r--r--LibMatrix/Responses/UserProfileResponse.cs1
6 files changed, 26 insertions, 29 deletions
diff --git a/LibMatrix/Responses/Admin/AdminRoomListingResult.cs b/LibMatrix/Responses/Admin/AdminRoomListingResult.cs
index f035184..a90bc6f 100644
--- a/LibMatrix/Responses/Admin/AdminRoomListingResult.cs
+++ b/LibMatrix/Responses/Admin/AdminRoomListingResult.cs
@@ -20,7 +20,7 @@ public class AdminRoomListingResult {
 
     public class AdminRoomListingResultRoom {
         [JsonPropertyName("room_id")]
-        public string RoomId { get; set; }
+        public required string RoomId { get; set; }
 
         [JsonPropertyName("name")]
         public string? Name { get; set; }
@@ -35,10 +35,10 @@ public class AdminRoomListingResult {
         public int JoinedLocalMembers { get; set; }
 
         [JsonPropertyName("version")]
-        public string Version { get; set; }
+        public string? Version { get; set; }
 
         [JsonPropertyName("creator")]
-        public string Creator { get; set; }
+        public string? Creator { get; set; }
 
         [JsonPropertyName("encryption")]
         public string? Encryption { get; set; }
diff --git a/LibMatrix/Responses/CreateRoomRequest.cs b/LibMatrix/Responses/CreateRoomRequest.cs
index 85db517..f8d1d05 100644
--- a/LibMatrix/Responses/CreateRoomRequest.cs
+++ b/LibMatrix/Responses/CreateRoomRequest.cs
@@ -10,28 +10,28 @@ using LibMatrix.Interfaces;
 namespace LibMatrix.Responses;
 
 public class CreateRoomRequest {
-    [JsonIgnore] public CreationContentBaseType _creationContentBaseType;
+    [JsonIgnore] public CreationContentBaseType CreationContentBaseType;
 
-    public CreateRoomRequest() => _creationContentBaseType = new CreationContentBaseType(this);
+    public CreateRoomRequest() => CreationContentBaseType = new CreationContentBaseType(this);
 
     [JsonPropertyName("name")]
-    public string Name { get; set; } = null!;
+    public string? Name { get; set; }
 
     [JsonPropertyName("room_alias_name")]
-    public string RoomAliasName { get; set; } = null!;
+    public string? RoomAliasName { get; set; }
 
     //we dont want to use this, we want more control
     // [JsonPropertyName("preset")]
     // public string Preset { get; set; } = null!;
 
     [JsonPropertyName("initial_state")]
-    public List<StateEvent> InitialState { get; set; } = null!;
+    public List<StateEvent>? InitialState { get; set; }
 
     /// <summary>
     /// One of: ["public", "private"]
     /// </summary>
     [JsonPropertyName("visibility")]
-    public string Visibility { get; set; } = null!;
+    public string? Visibility { get; set; }
 
     [JsonPropertyName("power_level_content_override")]
     public RoomPowerLevelEventContent PowerLevelContentOverride { get; set; } = null!;
@@ -46,25 +46,25 @@ public class CreateRoomRequest {
     ///     For use only when you can't use the CreationContent property
     /// </summary>
 
-    public StateEvent this[string event_type, string event_key = ""] {
+    public StateEvent this[string eventType, string eventKey = ""] {
         get {
-            var stateEvent = InitialState.FirstOrDefault(x => x.Type == event_type && x.StateKey == event_key);
+            var stateEvent = InitialState.FirstOrDefault(x => x.Type == eventType && x.StateKey == eventKey);
             if (stateEvent == null) {
                 InitialState.Add(stateEvent = new StateEvent {
-                    Type = event_type,
-                    StateKey = event_key,
+                    Type = eventType,
+                    StateKey = eventKey,
                     TypedContent = (EventContent)Activator.CreateInstance(
                         StateEvent.KnownStateEventTypes.FirstOrDefault(x =>
                             x.GetCustomAttributes<MatrixEventAttribute>()?
-                                .Any(y => y.EventName == event_type) ?? false) ?? typeof(object)
-                    )
+                                .Any(y => y.EventName == eventType) ?? false) ?? typeof(object)
+                    )!
                 });
             }
 
             return stateEvent;
         }
         set {
-            var stateEvent = InitialState.FirstOrDefault(x => x.Type == event_type && x.StateKey == event_key);
+            var stateEvent = InitialState.FirstOrDefault(x => x.Type == eventType && x.StateKey == eventKey);
             if (stateEvent == null)
                 InitialState.Add(value);
             else
diff --git a/LibMatrix/Responses/CreationContentBaseType.cs b/LibMatrix/Responses/CreationContentBaseType.cs
index ba3ce5e..073bb60 100644
--- a/LibMatrix/Responses/CreationContentBaseType.cs
+++ b/LibMatrix/Responses/CreationContentBaseType.cs
@@ -3,16 +3,16 @@ using System.Text.Json.Serialization;
 namespace LibMatrix.Responses;
 
 public class CreationContentBaseType {
-    private readonly CreateRoomRequest createRoomRequest;
+    private readonly CreateRoomRequest _createRoomRequest;
 
-    public CreationContentBaseType(CreateRoomRequest createRoomRequest) => this.createRoomRequest = createRoomRequest;
+    public CreationContentBaseType(CreateRoomRequest createRoomRequest) => this._createRoomRequest = createRoomRequest;
 
     [JsonPropertyName("type")]
     public string Type {
-        get => (string)createRoomRequest.CreationContent["type"];
+        get => (string)_createRoomRequest.CreationContent["type"];
         set {
-            if (value is "null" or "") createRoomRequest.CreationContent.Remove("type");
-            else createRoomRequest.CreationContent["type"] = value;
+            if (value is "null" or "") _createRoomRequest.CreationContent.Remove("type");
+            else _createRoomRequest.CreationContent["type"] = value;
         }
     }
 }
diff --git a/LibMatrix/Responses/LoginResponse.cs b/LibMatrix/Responses/LoginResponse.cs
index 82004fc..c5d4e87 100644
--- a/LibMatrix/Responses/LoginResponse.cs
+++ b/LibMatrix/Responses/LoginResponse.cs
@@ -1,7 +1,5 @@
-using System.ComponentModel.DataAnnotations;
 using System.Text.Json.Serialization;
 using LibMatrix.Homeservers;
-using LibMatrix.Services;
 
 namespace LibMatrix.Responses;
 
diff --git a/LibMatrix/Responses/SyncResponse.cs b/LibMatrix/Responses/SyncResponse.cs
index d3130bb..42759ff 100644
--- a/LibMatrix/Responses/SyncResponse.cs
+++ b/LibMatrix/Responses/SyncResponse.cs
@@ -50,13 +50,13 @@ public class SyncResponse {
 
         public class LeftRoomDataStructure {
             [JsonPropertyName("account_data")]
-            public EventList AccountData { get; set; }
+            public EventList? AccountData { get; set; }
 
             [JsonPropertyName("timeline")]
             public JoinedRoomDataStructure.TimelineDataStructure? Timeline { get; set; }
 
             [JsonPropertyName("state")]
-            public EventList State { get; set; }
+            public EventList? State { get; set; }
         }
 
         public class JoinedRoomDataStructure {
@@ -99,13 +99,13 @@ public class SyncResponse {
 
             public class SummaryDataStructure {
                 [JsonPropertyName("m.heroes")]
-                public List<string> Heroes { get; set; }
+                public List<string>? Heroes { get; set; }
 
                 [JsonPropertyName("m.invited_member_count")]
-                public int InvitedMemberCount { get; set; }
+                public int? InvitedMemberCount { get; set; }
 
                 [JsonPropertyName("m.joined_member_count")]
-                public int JoinedMemberCount { get; set; }
+                public int? JoinedMemberCount { get; set; }
             }
         }
 
diff --git a/LibMatrix/Responses/UserProfileResponse.cs b/LibMatrix/Responses/UserProfileResponse.cs
index e56e87b..9972a26 100644
--- a/LibMatrix/Responses/UserProfileResponse.cs
+++ b/LibMatrix/Responses/UserProfileResponse.cs
@@ -1,5 +1,4 @@
 using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
 
 namespace LibMatrix.Responses;