about summary refs log tree commit diff
path: root/LibMatrix/Responses/UserProfileResponse.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-09-08 23:53:27 +0200
committerRory& <root@rory.gay>2024-09-08 23:53:27 +0200
commit5b394ea44ea0bf3f1c5bd4d5a0a13d8be2018582 (patch)
tree39ab019b65ec9f17037290c1bfd53377de50bef9 /LibMatrix/Responses/UserProfileResponse.cs
parentClean up dev stuff a little bit (diff)
downloadLibMatrix-5b394ea44ea0bf3f1c5bd4d5a0a13d8be2018582.tar.xz
meow
Diffstat (limited to '')
-rw-r--r--LibMatrix/Responses/UserProfileResponse.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/LibMatrix/Responses/UserProfileResponse.cs b/LibMatrix/Responses/UserProfileResponse.cs
index 6c9380f..30e4c32 100644
--- a/LibMatrix/Responses/UserProfileResponse.cs
+++ b/LibMatrix/Responses/UserProfileResponse.cs
@@ -1,3 +1,4 @@
+using System.Text.Json;
 using System.Text.Json.Serialization;
 
 namespace LibMatrix.Responses;
@@ -8,4 +9,18 @@ public class UserProfileResponse {
 
     [JsonPropertyName("displayname")]
     public string? DisplayName { get; set; }
+
+    // MSC 4133 - Extending User Profile API with Key:Value pairs
+    [JsonExtensionData]
+    public Dictionary<string, JsonElement>? CustomKeys { get; set; }
+
+    public JsonElement? this[string key] {
+        get => CustomKeys?[key];
+        set {
+            if (value is null)
+                CustomKeys?.Remove(key);
+            else
+                (CustomKeys ??= [])[key] = value.Value;
+        }
+    }
 }
\ No newline at end of file