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/AdminRoomDeleteRequest.cs7
-rw-r--r--LibMatrix/Responses/Admin/AdminRoomListingResult.cs2
-rw-r--r--LibMatrix/Responses/ClientVersionsResponse.cs2
-rw-r--r--LibMatrix/Responses/CreateRoomRequest.cs30
-rw-r--r--LibMatrix/Responses/CreationContentBaseType.cs4
-rw-r--r--LibMatrix/Responses/LoginResponse.cs8
-rw-r--r--LibMatrix/Responses/ModAS/AdminRoomListingResult.cs4
-rw-r--r--LibMatrix/Responses/UserProfileResponse.cs2
8 files changed, 32 insertions, 27 deletions
diff --git a/LibMatrix/Responses/Admin/AdminRoomDeleteRequest.cs b/LibMatrix/Responses/Admin/AdminRoomDeleteRequest.cs
index f22c8d2..ceb1b3f 100644
--- a/LibMatrix/Responses/Admin/AdminRoomDeleteRequest.cs
+++ b/LibMatrix/Responses/Admin/AdminRoomDeleteRequest.cs
@@ -5,14 +5,19 @@ namespace LibMatrix.Responses.Admin;
 public class AdminRoomDeleteRequest {
     [JsonPropertyName("new_room_user_id")]
     public string? NewRoomUserId { get; set; }
+
     [JsonPropertyName("room_name")]
     public string? RoomName { get; set; }
+
     [JsonPropertyName("block")]
     public bool Block { get; set; }
+
     [JsonPropertyName("purge")]
     public bool Purge { get; set; }
+
     [JsonPropertyName("message")]
     public string? Message { get; set; }
+
     [JsonPropertyName("force_purge")]
     public bool ForcePurge { get; set; }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix/Responses/Admin/AdminRoomListingResult.cs b/LibMatrix/Responses/Admin/AdminRoomListingResult.cs
index a90bc6f..7ab96ac 100644
--- a/LibMatrix/Responses/Admin/AdminRoomListingResult.cs
+++ b/LibMatrix/Responses/Admin/AdminRoomListingResult.cs
@@ -61,4 +61,4 @@ public class AdminRoomListingResult {
         [JsonPropertyName("state_events")]
         public int StateEvents { get; set; }
     }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix/Responses/ClientVersionsResponse.cs b/LibMatrix/Responses/ClientVersionsResponse.cs
index 8e0a92a..8965857 100644
--- a/LibMatrix/Responses/ClientVersionsResponse.cs
+++ b/LibMatrix/Responses/ClientVersionsResponse.cs
@@ -8,4 +8,4 @@ public class ClientVersionsResponse {
 
     [JsonPropertyName("unstable_features")]
     public Dictionary<string, bool> UnstableFeatures { get; set; } = new();
-}
+}
\ No newline at end of file
diff --git a/LibMatrix/Responses/CreateRoomRequest.cs b/LibMatrix/Responses/CreateRoomRequest.cs
index 9a797b5..d78f574 100644
--- a/LibMatrix/Responses/CreateRoomRequest.cs
+++ b/LibMatrix/Responses/CreateRoomRequest.cs
@@ -52,7 +52,7 @@ public class CreateRoomRequest {
     public StateEvent this[string eventType, string eventKey = ""] {
         get {
             var stateEvent = InitialState.FirstOrDefault(x => x.Type == eventType && x.StateKey == eventKey);
-            if (stateEvent == null) {
+            if (stateEvent == null)
                 InitialState.Add(stateEvent = new StateEvent {
                     Type = eventType,
                     StateKey = eventKey,
@@ -62,7 +62,6 @@ public class CreateRoomRequest {
                                 .Any(y => y.EventName == eventType) ?? false) ?? typeof(UnknownEventContent)
                     )!
                 });
-            }
 
             return stateEvent;
         }
@@ -88,8 +87,8 @@ public class CreateRoomRequest {
         var request = new CreateRoomRequest {
             Name = name ?? "New public Room",
             Visibility = "public",
-            CreationContent = new(),
-            PowerLevelContentOverride = new() {
+            CreationContent = new JsonObject(),
+            PowerLevelContentOverride = new RoomPowerLevelEventContent {
                 EventsDefault = 0,
                 UsersDefault = 0,
                 Kick = 50,
@@ -97,10 +96,10 @@ public class CreateRoomRequest {
                 Invite = 25,
                 StateDefault = 10,
                 Redact = 50,
-                NotificationsPl = new() {
+                NotificationsPl = new RoomPowerLevelEventContent.NotificationsPL {
                     Room = 10
                 },
-                Events = new() {
+                Events = new Dictionary<string, long> {
                     { "m.room.avatar", 50 },
                     { "m.room.canonical_alias", 50 },
                     { "m.room.encryption", 100 },
@@ -110,7 +109,7 @@ public class CreateRoomRequest {
                     { "m.room.server_acl", 100 },
                     { "m.room.tombstone", 100 }
                 },
-                Users = new() {
+                Users = new Dictionary<string, long> {
                     {
                         hs.UserId,
                         101
@@ -118,17 +117,18 @@ public class CreateRoomRequest {
                 }
             },
             RoomAliasName = roomAliasName,
-            InitialState = new()
+            InitialState = new List<StateEvent>()
         };
 
         return request;
     }
+
     public static CreateRoomRequest CreatePrivate(AuthenticatedHomeserverGeneric hs, string? name = null, string? roomAliasName = null) {
         var request = new CreateRoomRequest {
             Name = name ?? "New private Room",
             Visibility = "private",
-            CreationContent = new(),
-            PowerLevelContentOverride = new() {
+            CreationContent = new JsonObject(),
+            PowerLevelContentOverride = new RoomPowerLevelEventContent {
                 EventsDefault = 0,
                 UsersDefault = 0,
                 Kick = 50,
@@ -136,10 +136,10 @@ public class CreateRoomRequest {
                 Invite = 25,
                 StateDefault = 10,
                 Redact = 50,
-                NotificationsPl = new() {
+                NotificationsPl = new RoomPowerLevelEventContent.NotificationsPL {
                     Room = 10
                 },
-                Events = new() {
+                Events = new Dictionary<string, long> {
                     { "m.room.avatar", 50 },
                     { "m.room.canonical_alias", 50 },
                     { "m.room.encryption", 100 },
@@ -149,7 +149,7 @@ public class CreateRoomRequest {
                     { "m.room.server_acl", 100 },
                     { "m.room.tombstone", 100 }
                 },
-                Users = new() {
+                Users = new Dictionary<string, long> {
                     {
                         hs.UserId,
                         101
@@ -157,9 +157,9 @@ public class CreateRoomRequest {
                 }
             },
             RoomAliasName = roomAliasName,
-            InitialState = new()
+            InitialState = new List<StateEvent>()
         };
 
         return request;
     }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix/Responses/CreationContentBaseType.cs b/LibMatrix/Responses/CreationContentBaseType.cs
index 073bb60..b4fd849 100644
--- a/LibMatrix/Responses/CreationContentBaseType.cs
+++ b/LibMatrix/Responses/CreationContentBaseType.cs
@@ -5,7 +5,7 @@ namespace LibMatrix.Responses;
 public class CreationContentBaseType {
     private readonly CreateRoomRequest _createRoomRequest;
 
-    public CreationContentBaseType(CreateRoomRequest createRoomRequest) => this._createRoomRequest = createRoomRequest;
+    public CreationContentBaseType(CreateRoomRequest createRoomRequest) => _createRoomRequest = createRoomRequest;
 
     [JsonPropertyName("type")]
     public string Type {
@@ -15,4 +15,4 @@ public class CreationContentBaseType {
             else _createRoomRequest.CreationContent["type"] = value;
         }
     }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix/Responses/LoginResponse.cs b/LibMatrix/Responses/LoginResponse.cs
index c5d4e87..3962fa6 100644
--- a/LibMatrix/Responses/LoginResponse.cs
+++ b/LibMatrix/Responses/LoginResponse.cs
@@ -21,11 +21,11 @@ public class LoginResponse {
     [JsonPropertyName("user_id")]
     public string UserId { get; set; } = null!;
 
-    public async Task<AuthenticatedHomeserverGeneric> GetAuthenticatedHomeserver(string? proxy = null) {
+    public async Task<AuthenticatedHomeserverGeneric> GetAuthenticatedHomeserver(string? proxy = null) =>
         // var urls = await new HomeserverResolverService().ResolveHomeserverFromWellKnown(Homeserver);
-        return await AuthenticatedHomeserverGeneric.Create<AuthenticatedHomeserverGeneric>(Homeserver, AccessToken, proxy);
-    }
+        await AuthenticatedHomeserverGeneric.Create<AuthenticatedHomeserverGeneric>(Homeserver, AccessToken, proxy);
 }
+
 public class LoginRequest {
     [JsonPropertyName("type")]
     public string Type { get; set; } = "m.login.password";
@@ -46,4 +46,4 @@ public class LoginRequest {
         [JsonPropertyName("user")]
         public string User { get; set; } = "";
     }
-}
+}
\ No newline at end of file
diff --git a/LibMatrix/Responses/ModAS/AdminRoomListingResult.cs b/LibMatrix/Responses/ModAS/AdminRoomListingResult.cs
index 95e3dcf..2d8d387 100644
--- a/LibMatrix/Responses/ModAS/AdminRoomListingResult.cs
+++ b/LibMatrix/Responses/ModAS/AdminRoomListingResult.cs
@@ -44,7 +44,7 @@ public class ModASRoomQueryResult {
 
     [JsonPropertyName("state_events")]
     public int StateEvents { get; set; }
-    
+
     [JsonPropertyName("type")]
     public string? Type { get; set; }
 
@@ -56,7 +56,7 @@ public class ModASRoomQueryResult {
 
     [JsonPropertyName("total_members")]
     public int TotalMembers { get; set; }
-    
+
     [JsonPropertyName("total_local_members")]
     public int TotalLocalMembers { get; set; }
 }
\ No newline at end of file
diff --git a/LibMatrix/Responses/UserProfileResponse.cs b/LibMatrix/Responses/UserProfileResponse.cs
index 9972a26..6c9380f 100644
--- a/LibMatrix/Responses/UserProfileResponse.cs
+++ b/LibMatrix/Responses/UserProfileResponse.cs
@@ -8,4 +8,4 @@ public class UserProfileResponse {
 
     [JsonPropertyName("displayname")]
     public string? DisplayName { get; set; }
-}
+}
\ No newline at end of file