about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core/AuthenticatedHomeServer.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-26 02:43:54 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-27 17:43:00 +0200
commit3ed00f732a284b5a3e96e52d4e3a71869135869b (patch)
tree308cdd5c9891a676dc55cbf0e0e998ab5a74b2d2 /MatrixRoomUtils.Core/AuthenticatedHomeServer.cs
parentWorking state, refactored Rory&::LibMatrix (diff)
downloadMatrixUtils-3ed00f732a284b5a3e96e52d4e3a71869135869b.tar.xz
Dependency injection stuff
Diffstat (limited to '')
-rw-r--r--MatrixRoomUtils.Core/AuthenticatedHomeServer.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/MatrixRoomUtils.Core/AuthenticatedHomeServer.cs b/MatrixRoomUtils.Core/AuthenticatedHomeServer.cs

index 23e98ae..b7e01dd 100644 --- a/MatrixRoomUtils.Core/AuthenticatedHomeServer.cs +++ b/MatrixRoomUtils.Core/AuthenticatedHomeServer.cs
@@ -42,14 +42,14 @@ public class AuthenticatedHomeServer : IHomeServer { return this; } - public async Task<Room> GetRoom(string roomId) => new Room(_httpClient, roomId); + public async Task<GenericRoom> GetRoom(string roomId) => new(this, roomId); - public async Task<List<Room>> GetJoinedRooms() { - var rooms = new List<Room>(); + public async Task<List<GenericRoom>> GetJoinedRooms() { + var rooms = new List<GenericRoom>(); var roomQuery = await _httpClient.GetAsync("/_matrix/client/v3/joined_rooms"); var roomsJson = await roomQuery.Content.ReadFromJsonAsync<JsonElement>(); - foreach (var room in roomsJson.GetProperty("joined_rooms").EnumerateArray()) rooms.Add(new Room(_httpClient, room.GetString())); + foreach (var room in roomsJson.GetProperty("joined_rooms").EnumerateArray()) rooms.Add(new GenericRoom(this, room.GetString())); Console.WriteLine($"Fetched {rooms.Count} rooms"); @@ -67,7 +67,7 @@ public class AuthenticatedHomeServer : IHomeServer { return resJson.GetProperty("content_uri").GetString()!; } - public async Task<Room> CreateRoom(CreateRoomRequest creationEvent) { + public async Task<GenericRoom> CreateRoom(CreateRoomRequest creationEvent) { var res = await _httpClient.PostAsJsonAsync("/_matrix/client/v3/createRoom", creationEvent); if (!res.IsSuccessStatusCode) { Console.WriteLine($"Failed to create room: {await res.Content.ReadAsStringAsync()}");