about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core/Responses
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Core/Responses')
-rw-r--r--MatrixRoomUtils.Core/Responses/Admin/AdminRoomListingResult.cs66
-rw-r--r--MatrixRoomUtils.Core/Responses/ProfileResponse.cs2
-rw-r--r--MatrixRoomUtils.Core/Responses/StateEventResponse.cs26
3 files changed, 84 insertions, 10 deletions
diff --git a/MatrixRoomUtils.Core/Responses/Admin/AdminRoomListingResult.cs b/MatrixRoomUtils.Core/Responses/Admin/AdminRoomListingResult.cs
new file mode 100644
index 0000000..8ec0e4f
--- /dev/null
+++ b/MatrixRoomUtils.Core/Responses/Admin/AdminRoomListingResult.cs
@@ -0,0 +1,66 @@
+using System.Text.Json.Serialization;
+
+namespace MatrixRoomUtils.Core.Responses.Admin;
+
+public class AdminRoomListingResult
+{
+    [JsonPropertyName("offset")]
+    public int Offset { get; set; }
+
+    [JsonPropertyName("total_rooms")]
+    public int TotalRooms { get; set; }
+
+    [JsonPropertyName("next_batch")]
+    public int? NextBatch { get; set; }
+
+    [JsonPropertyName("prev_batch")]
+    public int? PrevBatch { get; set; }
+
+    [JsonPropertyName("rooms")]
+    public List<AdminRoomListingResultRoom> Rooms { get; set; } = new();
+
+    public class AdminRoomListingResultRoom
+    {
+        [JsonPropertyName("room_id")]
+        public string RoomId { get; set; }
+
+        [JsonPropertyName("name")]
+        public string Name { get; set; }
+
+        [JsonPropertyName("canonical_alias")]
+        public string CanonicalAlias { get; set; }
+
+        [JsonPropertyName("joined_members")]
+        public int JoinedMembers { get; set; }
+
+        [JsonPropertyName("joined_local_members")]
+        public int JoinedLocalMembers { get; set; }
+
+        [JsonPropertyName("version")]
+        public string Version { get; set; }
+
+        [JsonPropertyName("creator")]
+        public string Creator { get; set; }
+
+        [JsonPropertyName("encryption")]
+        public string Encryption { get; set; }
+
+        [JsonPropertyName("federatable")]
+        public bool Federatable { get; set; }
+
+        [JsonPropertyName("public")]
+        public bool Public { get; set; }
+
+        [JsonPropertyName("join_rules")]
+        public string JoinRules { get; set; }
+
+        [JsonPropertyName("guest_access")]
+        public string GuestAccess { get; set; }
+
+        [JsonPropertyName("history_visibility")]
+        public string HistoryVisibility { get; set; }
+
+        [JsonPropertyName("state_events")]
+        public int StateEvents { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Core/Responses/ProfileResponse.cs b/MatrixRoomUtils.Core/Responses/ProfileResponse.cs
index f8026cb..2c0b679 100644
--- a/MatrixRoomUtils.Core/Responses/ProfileResponse.cs
+++ b/MatrixRoomUtils.Core/Responses/ProfileResponse.cs
@@ -7,5 +7,5 @@ public class ProfileResponse
     [JsonPropertyName("avatar_url")]
     public string? AvatarUrl { get; set; } = "";
     [JsonPropertyName("displayname")]
-    public string DisplayName { get; set; } = "";
+    public string? DisplayName { get; set; } = "";
 }
\ No newline at end of file
diff --git a/MatrixRoomUtils.Core/Responses/StateEventResponse.cs b/MatrixRoomUtils.Core/Responses/StateEventResponse.cs
index 1af3e1f..670c121 100644
--- a/MatrixRoomUtils.Core/Responses/StateEventResponse.cs
+++ b/MatrixRoomUtils.Core/Responses/StateEventResponse.cs
@@ -2,22 +2,16 @@ using System.Text.Json.Serialization;
 
 namespace MatrixRoomUtils.Core;
 
-public class StateEventResponse
+public class StateEventResponse : StateEvent
 {
-    [JsonPropertyName("content")]
-    public dynamic Content { get; set; }
     [JsonPropertyName("origin_server_ts")]
-    public long OriginServerTs { get; set; }
+    public ulong OriginServerTs { get; set; }
     [JsonPropertyName("room_id")]
     public string RoomId { get; set; }
     [JsonPropertyName("sender")]
     public string Sender { get; set; }
-    [JsonPropertyName("state_key")]
-    public string StateKey { get; set; }
-    [JsonPropertyName("type")]
-    public string Type { get; set; }
     [JsonPropertyName("unsigned")]
-    public dynamic Unsigned { get; set; }
+    public UnsignedData? Unsigned { get; set; }
     [JsonPropertyName("event_id")]
     public string EventId { get; set; }
     [JsonPropertyName("user_id")]
@@ -26,6 +20,20 @@ public class StateEventResponse
     public string ReplacesState { get; set; }
     [JsonPropertyName("prev_content")]
     public dynamic PrevContent { get; set; }
+    
+    
+    public class UnsignedData
+    {
+        [JsonPropertyName("age")]
+        public ulong Age { get; set; }
+        [JsonPropertyName("prev_content")]
+        public dynamic? PrevContent { get; set; }
+        [JsonPropertyName("redacted_because")]
+        public dynamic? RedactedBecause { get; set; }
+        [JsonPropertyName("transaction_id")]
+        public string? TransactionId { get; set; }
+        
+    }
 }
 
 public class StateEventResponse<T> : StateEventResponse where T : class