From e5591eef3850a9796cc87386128651a828b70697 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Fri, 6 Oct 2023 18:29:15 +0200 Subject: Small refactors --- LibMatrix/Responses/SyncResponse.cs | 118 ++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 LibMatrix/Responses/SyncResponse.cs (limited to 'LibMatrix/Responses/SyncResponse.cs') diff --git a/LibMatrix/Responses/SyncResponse.cs b/LibMatrix/Responses/SyncResponse.cs new file mode 100644 index 0000000..39cb38f --- /dev/null +++ b/LibMatrix/Responses/SyncResponse.cs @@ -0,0 +1,118 @@ +using System.Text.Json.Serialization; +using LibMatrix.Helpers; + +namespace LibMatrix.Responses; + +public class SyncResponse { + [JsonPropertyName("next_batch")] + public string NextBatch { get; set; } = null!; + + [JsonPropertyName("account_data")] + public EventList? AccountData { get; set; } + + [JsonPropertyName("presence")] + public PresenceDataStructure? Presence { get; set; } + + [JsonPropertyName("device_one_time_keys_count")] + public Dictionary? DeviceOneTimeKeysCount { get; set; } = null!; + + [JsonPropertyName("rooms")] + public RoomsDataStructure? Rooms { get; set; } + + [JsonPropertyName("to_device")] + public EventList? ToDevice { get; set; } + + [JsonPropertyName("device_lists")] + public DeviceListsDataStructure? DeviceLists { get; set; } + + public class DeviceListsDataStructure { + [JsonPropertyName("changed")] + public List? Changed { get; set; } + + [JsonPropertyName("left")] + public List? Left { get; set; } + } + + // supporting classes + public class PresenceDataStructure { + [JsonPropertyName("events")] + public List Events { get; set; } = new(); + } + + public class RoomsDataStructure { + [JsonPropertyName("join")] + public Dictionary? Join { get; set; } + + [JsonPropertyName("invite")] + public Dictionary? Invite { get; set; } + + [JsonPropertyName("leave")] + public Dictionary? Leave { get; set; } + + public class LeftRoomDataStructure { + [JsonPropertyName("account_data")] + public EventList AccountData { get; set; } + + [JsonPropertyName("timeline")] + public JoinedRoomDataStructure.TimelineDataStructure? Timeline { get; set; } + + [JsonPropertyName("state")] + public EventList State { get; set; } + } + + public class JoinedRoomDataStructure { + [JsonPropertyName("timeline")] + public TimelineDataStructure? Timeline { get; set; } + + [JsonPropertyName("state")] + public EventList? State { get; set; } + + [JsonPropertyName("account_data")] + public EventList? AccountData { get; set; } + + [JsonPropertyName("ephemeral")] + public EventList? Ephemeral { get; set; } + + [JsonPropertyName("unread_notifications")] + public UnreadNotificationsDataStructure? UnreadNotifications { get; set; } + + [JsonPropertyName("summary")] + public SummaryDataStructure? Summary { get; set; } + + public class TimelineDataStructure { + [JsonPropertyName("events")] + public List? Events { get; set; } + + [JsonPropertyName("prev_batch")] + public string? PrevBatch { get; set; } + + [JsonPropertyName("limited")] + public bool? Limited { get; set; } + } + + public class UnreadNotificationsDataStructure { + [JsonPropertyName("notification_count")] + public int NotificationCount { get; set; } + + [JsonPropertyName("highlight_count")] + public int HighlightCount { get; set; } + } + + public class SummaryDataStructure { + [JsonPropertyName("m.heroes")] + public List Heroes { get; set; } + + [JsonPropertyName("m.invited_member_count")] + public int InvitedMemberCount { get; set; } + + [JsonPropertyName("m.joined_member_count")] + public int JoinedMemberCount { get; set; } + } + } + + public class InvitedRoomDataStructure { + [JsonPropertyName("invite_state")] + public EventList? InviteState { get; set; } + } + } +} -- cgit 1.4.1