From 5b394ea44ea0bf3f1c5bd4d5a0a13d8be2018582 Mon Sep 17 00:00:00 2001 From: Rory& Date: Sun, 8 Sep 2024 23:53:27 +0200 Subject: meow --- LibMatrix/Responses/UserProfileResponse.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'LibMatrix/Responses/UserProfileResponse.cs') 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? 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 -- cgit 1.4.1