about summary refs log tree commit diff
path: root/Tests/LibMatrix.HomeserverEmulator/Controllers/VersionsController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/LibMatrix.HomeserverEmulator/Controllers/VersionsController.cs')
-rw-r--r--Tests/LibMatrix.HomeserverEmulator/Controllers/VersionsController.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/Tests/LibMatrix.HomeserverEmulator/Controllers/VersionsController.cs b/Tests/LibMatrix.HomeserverEmulator/Controllers/VersionsController.cs
index 1349fac..704e26b 100644
--- a/Tests/LibMatrix.HomeserverEmulator/Controllers/VersionsController.cs
+++ b/Tests/LibMatrix.HomeserverEmulator/Controllers/VersionsController.cs
@@ -1,4 +1,5 @@
 using System.Text.Json.Nodes;

+using System.Text.Json.Serialization;

 using LibMatrix.Homeservers;

 using LibMatrix.Responses;

 using LibMatrix.Services;

@@ -45,4 +46,47 @@ public class VersionsController(ILogger<WellKnownController> logger) : Controlle
         };

         return clientVersions;

     }

+

+    [HttpGet("client/{version}/capabilities")]

+    public async Task<CapabilitiesResponse> GetCapabilities() {

+        return new() {

+            Capabilities = new() {

+                ChangePassword = new() {

+                    Enabled = false

+                },

+                RoomVersions = new() {

+                    Default = "11",

+                    Available = new() {

+                        ["11"] = "unstable"

+                    }

+                }

+            }

+        };

+    }

+}

+

+public class CapabilitiesResponse {

+    [JsonPropertyName("capabilities")]

+    public CapabilitiesContent Capabilities { get; set; }

+

+    public class CapabilitiesContent {

+        [JsonPropertyName("m.room_versions")]

+        public RoomVersionsContent RoomVersions { get; set; }

+        

+        [JsonPropertyName("m.change_password")]

+        public ChangePasswordContent ChangePassword { get; set; }

+

+        public class ChangePasswordContent {

+            [JsonPropertyName("enabled")]

+            public bool Enabled { get; set; }

+        }

+

+        public class RoomVersionsContent {

+            [JsonPropertyName("default")]

+            public string Default { get; set; }

+

+            [JsonPropertyName("available")]

+            public Dictionary<string, string> Available { get; set; }

+        }

+    }

 }
\ No newline at end of file