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-12-15 02:18:15 +0100
commitdb0e87c0d610dbb24c3b62b37f2639245e9c3d3b (patch)
tree76d9341d51dc3a4f36cc60fd2b3a1c4afb9ec7f5 /LibMatrix/Responses/UserProfileResponse.cs
parentClean up dev stuff a little bit (diff)
downloadLibMatrix-db0e87c0d610dbb24c3b62b37f2639245e9c3d3b.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